[Bug c++/95085] diagnostic on designated-initializer from braced-init-list could be better

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue May 12 14:38:55 GMT 2020


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |diagnostic
   Last reconfirmed|                            |2020-05-12

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
There is a related problem without designated initializers:

struct A { A(int); };
int f(A);
int i = f(A(nullptr));
int j = f(A{nullptr});

d.cc:3:20: error: no matching function for call to 'A::A(std::nullptr_t)'
...
d.cc:4:20: error: no matching function for call to 'A::A(<brace-enclosed
initializer list>)'
...

It also seems inconsistent to say "initializer list argument" in one place and 
"<brace-enclosed initializer list>" in another, although maybe the latter is
because it's inside a quoted C++ expression, not prose.


More information about the Gcc-bugs mailing list