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

            Bug ID: 97422
           Summary: gcc rejects 'std::initializer_list' when instantiating
                    with a list
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tangyixuan at mail dot dlut.edu.cn
  Target Milestone: ---

Hi, when instantiating a function with a list of integer type, gcc rejects it
and reports two duplicate error messages. Clang accepts.

$ cat s.cpp

#include <initializer_list>
void func( std::initializer_list<int[1]> list) {}

int main()
{
   func( {{1},{2},{3}} );
}

$ g++ -c s.cpp
s.cpp: In function ‘int main()’:
s.cpp:6:24: error: array must be initialized with a brace-enclosed initializer
    6 |    func( {{1},{2},{3}} );
      |                        ^
s.cpp:6:24: error: array must be initialized with a brace-enclosed initializer
s.cpp:6:24: error: array must be initialized with a brace-enclosed initializer
  • [Bug c++/97422] New: gcc r... tangyixuan at mail dot dlut.edu.cn via Gcc-bugs

Reply via email to