https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95369
Bug ID: 95369
Summary: braced-init-list with designated initializers as
template-argument rejected
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
Target Milestone: ---
struct S {
unsigned a;
unsigned b;
#ifdef CTOR
constexpr S(unsigned _a, unsigned _b) noexcept: a{_a}, b{_b} { }
#endif
};
template <S p>
void fnc()
{
}
template<S s> struct X { };
void f()
{
fnc<{.a = 10, .b = 20}>();
X<{.a = 1, .b = 2}> x;
}
If CTOR is not defined, we reject, but if it is defined, we accept. We should
probably reverse this behavior. We should accept the aggregate initialization,
but with CTOR, S is no longer an aggregate (it has a user-declared or inherited
constructor).