gcc compiler bug ? testcase included, Was: Re: KDE/kdebase/kicker/kicker
Tim Beaulen
tbscope at gmail.com
Wed Jan 4 19:51:09 GMT 2006
tbscope at localhost ~ $ mkdir testgcc
tbscope at localhost ~ $ cd testgcc
tbscope at localhost ~/testgcc $ nano -w ./main.cpp
tbscope at localhost ~/testgcc $ g++ -Wall main.cpp -o ctorproblem
tbscope at localhost ~/testgcc $ dir
ctorproblem main.cpp
tbscope at localhost ~/testgcc $ g++ --version
g++ (GCC) 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
tbscope at localhost ~/testgcc $
On 1/4/06, Alexander Neundorf <neundorf at kde.org> 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 ?
>
> Bye
> Alex
> --
> Work: alexander.neundorf at jenoptik.com - http://www.jenoptik-los.de
> Home: neundorf at kde.org - http://www.kde.org
> alex at neundorf.net - http://www.neundorf.net
>
More information about the kde-core-devel
mailing list