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

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).