public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56418] New: <brace-enclosed initializer list> errors do not show the types (makes it hard to debug)
@ 2013-02-21 13:32 msclrhd at gmail dot com
2013-02-21 20:26 ` [Bug c++/56418] " manu at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: msclrhd at gmail dot com @ 2013-02-21 13:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56418
Bug #: 56418
Summary: <brace-enclosed initializer list> errors do not show
the types (makes it hard to debug)
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: msclrhd@gmail.com
Created attachment 29518
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29518
Example of the problem.
When you have something like:
foo({ 1, 2, 3 });
vs:
foo(Bar(1, 2, 3));
the error message is hard to diagnose. See the attached foo.cpp for an example.
In the foo.cpp example, the lines that pass the wrong argument via explicit
construction ([5] and [7]) tell the user exactly what the problem is:
foo.cpp:12:21: note: candidates are:
foo.cpp:2:14: note: Foo::Foo(int, float, Bar)
foo.cpp:2:14: note: no known conversion for argument 3 from ‘int’ to
‘Bar’
whereas the lines that pass the arguments using the initializer list syntax are
impossible to diagnose from the error message:
foo.cpp:18:21: error: invalid initialization of reference of type ‘const
Foo&’ from expression of type ‘<brace-enclosed initializer list>’
foo.cpp:4:6: error: in passing argument 1 of ‘void foo(const Foo&)’
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/56418] <brace-enclosed initializer list> errors do not show the types (makes it hard to debug)
2013-02-21 13:32 [Bug c++/56418] New: <brace-enclosed initializer list> errors do not show the types (makes it hard to debug) msclrhd at gmail dot com
@ 2013-02-21 20:26 ` manu at gcc dot gnu.org
2021-07-24 10:56 ` pinskia at gcc dot gnu.org
2021-08-06 8:31 ` redi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu.org @ 2013-02-21 20:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56418
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu.org
--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2013-02-21 20:26:24 UTC ---
Clang doesn't do much better:
test.cc:18:3: error: no matching function for call to 'foo'
foo({ 1, 2.3, 123 }); // error -- argument mismatch [8]
^~~
test.cc:4:6: note: candidate function not viable: cannot convert initializer
list argument to 'const Foo'
void foo(const Foo &f);
^
but at least it doesn't print ‘<brace-enclosed initializer list>’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/56418] <brace-enclosed initializer list> errors do not show the types (makes it hard to debug)
2013-02-21 13:32 [Bug c++/56418] New: <brace-enclosed initializer list> errors do not show the types (makes it hard to debug) msclrhd at gmail dot com
2013-02-21 20:26 ` [Bug c++/56418] " manu at gcc dot gnu.org
@ 2021-07-24 10:56 ` pinskia at gcc dot gnu.org
2021-08-06 8:31 ` redi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-24 10:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56418
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |trivial
Keywords| |diagnostic
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/56418] <brace-enclosed initializer list> errors do not show the types (makes it hard to debug)
2013-02-21 13:32 [Bug c++/56418] New: <brace-enclosed initializer list> errors do not show the types (makes it hard to debug) msclrhd at gmail dot com
2013-02-21 20:26 ` [Bug c++/56418] " manu at gcc dot gnu.org
2021-07-24 10:56 ` pinskia at gcc dot gnu.org
@ 2021-08-06 8:31 ` redi at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-06 8:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56418
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2021-08-06
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-08-06 8:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-21 13:32 [Bug c++/56418] New: <brace-enclosed initializer list> errors do not show the types (makes it hard to debug) msclrhd at gmail dot com
2013-02-21 20:26 ` [Bug c++/56418] " manu at gcc dot gnu.org
2021-07-24 10:56 ` pinskia at gcc dot gnu.org
2021-08-06 8:31 ` redi 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).