http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45963

           Summary: inconsistent and poor array initialization diagnostic
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: igod...@pacbell.net


This code:
   class foo {
   public:
       foo(int i): i(i) {}
       foo() : i(0) {}
       int i;
       };
   class bar {
   public:
       bar() : a(1) {}
       bar(bool) : b(1) {}
       bar(int) : b() {}
       int a[5];
       foo b[5];
       };

   int main() {
       return 0;
       }
gets you this:
   s3:~/ootbc/members$ g++ foo.cc
   foo.cc: In constructor ‘bar::bar()’:
   foo.cc:9: error: incompatible types in assignment of ‘int’ to ‘int [5]’
   foo.cc: In constructor ‘bar::bar(bool)’:
   foo.cc:10: error: bad array initializer

In contrast, Comeau gives:
"ComeauTest.c", line 9: error: only "()" is allowed as initializer for array
member
          "bar::a"
      bar() : a(0) {}
                ^

"ComeauTest.c", line 10: error: only "()" is allowed as initializer for array
member
          "bar::b"
      bar(bool) : b(0) {}
                    ^

Reply via email to