gcc compiler bug ? testcase included, Was: Re: KDE/kdebase/kicker/kicker

R. p0z3r at earthlink.net
Wed Jan 4 22:01:07 GMT 2006


Works for me here:

[ryann][gcc_svn]$ ls
main.cpp
[ryann][gcc_svn]$ g++ -Wall main.cpp -o ctorproblem
[ryann][gcc_svn]$ ls
ctorproblem  main.cpp
[ryann][gcc_svn]$ gcc --version
gcc (GCC) 4.0.2 20050901 (prerelease) (SUSE Linux)

-----Original Message-----
>From: Alexander Neundorf <neundorf at kde.org>
>Sent: Jan 4, 2006 2:35 PM
>To: kde-core-devel at kde.org
>Subject: gcc compiler bug ? testcase included,	Was: Re: KDE/kdebase/kicker/kicker
>
>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