public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94685] New: Misleading error: array must be initialized with a brace-enclosed initializer
@ 2020-04-21 9:41 redi at gcc dot gnu.org
2020-04-21 9:47 ` [Bug c++/94685] " redi at gcc dot gnu.org
2020-04-21 16:42 ` mpolacek at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2020-04-21 9:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94685
Bug ID: 94685
Summary: Misleading error: array must be initialized with a
brace-enclosed initializer
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
using A = int[1];
using AA = A[1];
AA a1{A{1}};
ntconsarr.cc:3:9: error: array must be initialized with a brace-enclosed
initializer
3 | AA a1{A{1}};
| ^~~~
This clearly *is* a brace-enclosed initializer, so the error is not telling us
the real problem.
Clang is better:
$ clang++ ntconsarr.cc
ntconsarr.cc:3:9: error: cannot initialize an array element of type 'int' with
an rvalue of type 'A' (aka 'int [1]')
AA a1{A{1}};
^~~~
EDG is different, but I'm not sure it's correct:
$ edg --c++14 ntconsarr.cc
"ntconsarr.cc", line 3: error: a value of type "int *" cannot be used to
initialize an entity of type "int"
AA a1{A{1}};
^
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/94685] Misleading error: array must be initialized with a brace-enclosed initializer
2020-04-21 9:41 [Bug c++/94685] New: Misleading error: array must be initialized with a brace-enclosed initializer redi at gcc dot gnu.org
@ 2020-04-21 9:47 ` redi at gcc dot gnu.org
2020-04-21 16:42 ` mpolacek at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2020-04-21 9:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94685
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This diagnostic seems wrong too:
using A = int[1];
A a1{A{}};
ntconsarr.cc:1:26: error: taking address of temporary array
1 | using A = int[1]; A a1{A{}};
| ^~~
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/94685] Misleading error: array must be initialized with a brace-enclosed initializer
2020-04-21 9:41 [Bug c++/94685] New: Misleading error: array must be initialized with a brace-enclosed initializer redi at gcc dot gnu.org
2020-04-21 9:47 ` [Bug c++/94685] " redi at gcc dot gnu.org
@ 2020-04-21 16:42 ` mpolacek at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-21 16:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94685
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-04-21
Status|UNCONFIRMED |NEW
CC| |mpolacek at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-21 16:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21 9:41 [Bug c++/94685] New: Misleading error: array must be initialized with a brace-enclosed initializer redi at gcc dot gnu.org
2020-04-21 9:47 ` [Bug c++/94685] " redi at gcc dot gnu.org
2020-04-21 16:42 ` mpolacek at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).