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

Alexander Neundorf neundorf at kde.org
Wed Jan 4 19:35:21 GMT 2006


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