https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105419
Bug ID: 105419 Summary: [11 Regression] std::initializer_list<T> constructor invalid in C++20 mode Product: gcc Version: 11.3.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: whisperity at gmail dot com Target Milestone: --- The following code is rejected when compiled with `-std=c++20` if using G++ 11.y. `-std=c++17` accepts it. G++ 10.y accepts in both C++17 and C++20 version. #include <initializer_list> template <class T, class K = long long int> struct C { C<T, K>(std::initializer_list<T> L) {} }; int main() { C<int> Cont = {1, 2}; } Platform: X86_64 (amd64) Linux (specifically Ubuntu 20.04 LTS) Godbolt: http://godbolt.org/z/rrbae9P5d Compiler versions: Using built-in specs. COLLECT_GCC=/opt/compiler-explorer/gcc-10.3.0/bin/g++ Target: x86_64-linux-gnu Configured with: ../gcc-10.3.0/configure --prefix=/opt/compiler-explorer/gcc-build/staging --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-bootstrap --enable-multiarch --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --enable-clocale=gnu --enable-languages=c,c++,fortran,ada,go,d --enable-ld=yes --enable-gold=yes --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-linker-build-id --enable-lto --enable-plugins --enable-threads=posix --with-pkgversion=Compiler-Explorer-Build Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.3.0 (Compiler-Explorer-Build) COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-g' '-o' '/app/output.s' '-masm=intel' '-S' '-std=c++17' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /opt/compiler-explorer/gcc-10.3.0/bin/../libexec/gcc/x86_64-linux-gnu/10.3.0/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -iprefix /opt/compiler-explorer/gcc-10.3.0/bin/../lib/gcc/x86_64-linux-gnu/10.3.0/ -D_GNU_SOURCE <source> -quiet -dumpbase example.cpp -masm=intel -mtune=generic -march=x86-64 -auxbase-strip /app/output.s -g -std=c++17 -version -fdiagnostics-color=always -o /app/output.s GNU C++17 (Compiler-Explorer-Build) version 10.3.0 (x86_64-linux-gnu) compiled by GNU C version 7.5.0, GMP version 6.1.0, MPFR version 3.1.4, MPC version 1.0.3, isl version isl-0.18-GMP Using built-in specs. COLLECT_GCC=/opt/compiler-explorer/gcc-11.3.0/bin/g++ Target: x86_64-linux-gnu Configured with: ../gcc-11.3.0/configure --prefix=/opt/compiler-explorer/gcc-build/staging --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-bootstrap --enable-multiarch --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --enable-clocale=gnu --enable-languages=c,c++,fortran,ada,go,d --enable-ld=yes --enable-gold=yes --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-linker-build-id --enable-lto --enable-plugins --enable-threads=posix --with-pkgversion=Compiler-Explorer-Build-gcc--binutils-2.36.1 Thread model: posix Supported LTO compression algorithms: zlib gcc version 11.3.0 (Compiler-Explorer-Build-gcc--binutils-2.36.1) COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-g' '-o' '/app/output.s' '-masm=intel' '-S' '-std=c++20' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' '/app/' /opt/compiler-explorer/gcc-11.3.0/bin/../libexec/gcc/x86_64-linux-gnu/11.3.0/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -iprefix /opt/compiler-explorer/gcc-11.3.0/bin/../lib/gcc/x86_64-linux-gnu/11.3.0/ -D_GNU_SOURCE <source> -quiet -dumpdir /app/ -dumpbase output.cpp -dumpbase-ext .cpp -masm=intel -mtune=generic -march=x86-64 -g -std=c++20 -version -fdiagnostics-color=always -o /app/output.s GNU C++20 (Compiler-Explorer-Build-gcc--binutils-2.36.1) version 11.3.0 (x86_64-linux-gnu) compiled by GNU C version 7.5.0, GMP version 6.1.0, MPFR version 3.1.6, MPC version 1.0.3, isl version isl-0.18-GMP