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

            Bug ID: 126615
           Summary: [C++20] {} accepted as a template-argument for a
                    template template parameter with a placeholder type
           Product: gcc
           Version: 16.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

```
#include <initializer_list>

template <int N> struct A {};
template <template <auto> class TT> using G = TT<{}>;
using X = G<A>; // GCC accepts
```

auto cannot be deduced from an empty braced-init-list, so this should be
rejected. Clang, EDG and MSVC reject it; GCC also rejects the same parameter
written directly (template <auto V> struct Au {}; using X = Au<{}>;).

Dropping #include <initializer_list> makes GCC reject it too, with deducing
from brace-enclosed initializer list requires '#include <initializer_list>' -
yet no std::initializer_list takes part in the accepted path: TT becomes A, and
{} copy-initializes its int parameter.

Online demo: https://gcc.godbolt.org/z/jE4Tc1bb4

Reply via email to