https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62165

            Bug ID: 62165
           Summary: Misleading error messages when using "impossible"
                    brace initializer list
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: public at enkore dot de

Created attachment 33343
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33343&action=edit
Demonstrates the issue.

When trying to brace-initialize a container or something similar with
non-aggregate key or value types the error messages become long and misleading.
Since such initialization is not possible the error message should simply point
to that and why it is not possible.

err_neg.cc generates a pile of error messages unrelated to the error cause — in
this example the issue is simply that struct s is not an aggregate since it has
default values and thus an implicit default ctor. Thus it is not possible to
initialize a map with that value typ via brace initialization. A smart compiler
should point that out.

Reply via email to