Bug 26884 - [4.1/4.2 regression] Misleading diagnostic for invalid array initializer
Summary: [4.1/4.2 regression] Misleading diagnostic for invalid array initializer
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P2 normal
Target Milestone: 4.1.2
Assignee: Mark Shinwell
URL:
Keywords: diagnostic, monitored
Depends on:
Blocks:
 
Reported: 2006-03-27 12:01 UTC by Volker Reichelt
Modified: 2006-10-18 10:58 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.0.3
Known to fail: 4.1.0 4.2.0
Last reconfirmed: 2006-08-25 13:12:37


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-03-27 12:01:04 UTC
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.
Comment 1 Andrew Pinski 2006-03-27 16:42:12 UTC
Confirmed.
Comment 2 Mark Mitchell 2006-05-25 02:34:20 UTC
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
Comment 3 Mark Shinwell 2006-10-18 10:57:28 UTC
Subject: Bug 26884

Author: shinwell
Date: Wed Oct 18 10:57:18 2006
New Revision: 117854

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117854
Log:
        PR c++/26884
        * typeck2.c (digest_init): Raise error upon attempts to
        initialize arrays with variables.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck2.c

Comment 4 Mark Shinwell 2006-10-18 10:57:48 UTC
Subject: Bug 26884

Author: shinwell
Date: Wed Oct 18 10:57:37 2006
New Revision: 117855

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117855
Log:
        PR c++/26884
        * typeck2.c (digest_init): Raise error upon attempts to
        initialize arrays with variables.

Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/typeck2.c

Comment 5 Mark Shinwell 2006-10-18 10:58:38 UTC
Fixed in mainline and 4.1 (revs 117854 and 117855 respectively).