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

            Bug ID: 71542
           Summary: unhelpfull error for wrong initializer of initializer
                    list
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: denis.campredon at gmail dot com
  Target Milestone: ---

For the following code

------------
#include <initializer_list>

struct s
{
    int *i;
};
void f()
{   
    std::initializer_list<s> initializer = {{false}};
    s array[] = {{true}, {true}};
}
---------------

g++ emits the following error message :
---------------
main.cpp: In function 'void f()':
main.cpp:10:42: error: could not convert '{{false}}' from '<brace-enclosed
initializer list>' to 'std::initializer_list<s>'
     std::initializer_list<s> a = {{false}};
                                          ^
main.cpp:11:32: error: cannot convert 'bool' to 'int*' in initialization
     s array[] = {{true}, {true}};
                                ^
main.cpp:11:32: error: cannot convert 'bool' to 'int*' in initialization
--------------

But the message for the initializer_list is not really helpfull. I'd expect a
similar message than with the array.

Reply via email to