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

            Bug ID: 89315
           Summary: Cannot convert to std::initializer_list - fails with
                    gcc9 works with gcc8
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: larsbj at gullik dot net
  Target Milestone: ---

Created attachment 45675
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45675&action=edit
Soruce that works with gcc8 fails with gcc9

The attached code compiles with:

g++ --version
g++ (GCC) 8.2.1 20181215 (Red Hat 8.2.1-6)

but fails with

/opt/gcc/gcc-9/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/opt/gcc/gcc-9/bin/g++
COLLECT_LTO_WRAPPER=/opt/gcc/gcc-9/libexec/gcc/x86_64-pc-linux-gnu/9.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/opt/gcc/gcc-9
--enable-checking=release --enable-languages=c,c++

/opt/gcc/gcc-9/bin/g++ -c bug4.cpp 
bug4.cpp: In instantiation of ‘void n< <template-parameter-1-1> >::m_fn1()
[with <template-parameter-1-1> = void]’:
bug4.cpp:17:22:   required from here
bug4.cpp:13:24: error: cannot convert ‘const bar*’ to
‘std::initializer_list<int>’
   13 |     void m_fn1() { i{{}}; }
      |                        ^
bug4.cpp:4:9: note:   initializing argument 1 of
‘bar::bar(std::initializer_list<int>, int)’
    4 |     bar(std::initializer_list<int>, int = int());
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to