[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    gcc compiler bug ? testcase included,
From:       Alexander Neundorf <neundorf () kde ! org>
Date:       2006-01-04 19:35:21
Message-ID: 200601042035.22304.neundorf () kde ! org
[Download RAW message or body]

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@jenoptik.com - http://www.jenoptik-los.de
Home: neundorf@kde.org                - http://www.kde.org
      alex@neundorf.net               - http://www.neundorf.net
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic