This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/26884] New: [4.1/4.2 regression] Misleading diagnostic for invalid array initializer


For the follwoing code snippet a bogus diagnostic is emitted since
GCC 4.1.0:

================================
int main()
{
  int a[2] = { 2, 3 };
  int b[2] = a;
}
================================

bug.cc: In function 'int main()':
bug.cc:4: error: cannot convert 'int [2]' to 'int [2]' in initialization

This message is confusing since transforming int[2] into int[2]
shouldn't be hard. The problem is that you cannot use an array
for initialization at all.

Before we got:

bug.cc: In function 'int main()':
bug.cc:4: error: invalid initializer

which is not too helpful, but at least correct.


-- 
           Summary: [4.1/4.2 regression] Misleading diagnostic for invalid
                    array initializer
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: diagnostic, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]