This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/66895] New: Array to pointer decay in list initialization


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

            Bug ID: 66895
           Summary: Array to pointer decay in list initialization
           Product: gcc
           Version: 5.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sbergman at redhat dot com
  Target Milestone: ---

> $ cat test.cc
> #include <cstddef>
> #include <initializer_list>
> struct S {
>     template<std::size_t N> S(char const (&)[N]);
> };
> struct T { S s; };
> void f(std::initializer_list<T>);
> void g() { f({{""}}); }

> $ g++ -std=c++11 -fsyntax-only test.cc
> test.cc: In function âvoid g()â:
> test.cc:8:20: error: could not convert â(const char*)""â from âconst char*â to âSâ
>  void g() { f({{""}}); }
>                     ^

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]