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

            Bug ID: 111277
           Summary: braced-init-list allowed in a template-argument
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: janschultke at googlemail dot com
  Target Milestone: ---

## Code to reproduce (https://godbolt.org/z/ds7zo5Yeo)

#include <cstddef>

template <typename ValueType, std::size_t Size>
struct ArrayPrimitive
{
  constexpr ArrayPrimitive(const ValueType (&array)[Size]) {}
};

template <ArrayPrimitive T>
using ignore = void;

using i = ignore<{{1, 2, 3}}>;


## Explanation

A braced-init-list currently cannot appear in a template-argument.
This is a known defect (https://cplusplus.github.io/CWG/issues/2450.html), but
it is the status quo.

GCC rejects ignore<{1, 2, 3}>, but it does not reject ignore<{{1, 2, 3}}>.

I suspect it fails to recognize the latter as a braced-init-list for whatever
reason.

This bug was discovered here: https://stackoverflow.com/q/77032755/5740428
  • [Bug c++/111277] New: brace... janschultke at googlemail dot com via Gcc-bugs

Reply via email to