gcc compiler bug ? testcase included, Was: Re: KDE/kdebase/kicker/kicker
Thomas Braxton
brax108 at cox.net
Wed Jan 4 19:49:42 GMT 2006
On Wednesday 04 January 2006 13:35, Alexander Neundorf wrote:
> Hi,
>
> the following code doesn't compile with gcc 3.2.3:
>
> class Foo {
> public:
> Foo():m_i(0) {}
> Foo(int i):m_i(i) {}
> private:
> int m_i;
> };
>
> class Bar {
> public:
> Bar(const Foo& foo):m_k(0) {}
> Bar(const Foo& foo, int k):m_k(k) {}
> private:
> int m_k;
> };
>
> int main() {
> Bar bar(Foo(), 1);
> // Bar bar((const Foo&)Foo(), 1); //works, more typing
> // Bar bar(*&Foo(), 1); // works, but is ugly
> // Bar bar(Foo(0), 1); // works, but is something different
> // Bar bar(Foo()); // works, but is something different
> }
>
> When trying to compile this with gcc 3.2.3 it gives:
>
> ~/src/ctorproblem$ g++ -Wall main.cpp -o ctorproblem
> main.cpp: In function `int main()':
> main.cpp:20: type specifier omitted for parameter
> main.cpp:20: syntax error before numeric constant
>
> This is the same issue we have in svn in several places, e.g. here:
> http://lists.kde.org/?l=kde-commits&m=113639598413892&w=2
>
> What should we do about this ?
> Which versions of gcc are able to compile this ?
g++ 3.4.3 & 4.0.1 both compile this just fine.
Thomas
More information about the kde-core-devel
mailing list