1 2 3 4 5 6 7 8 9 10 11 12 13 14
// PR c++/94885 - paren-init of aggregates accepts invalid code. // { dg-do compile { target c++20 } } template <typename T, typename = decltype(T(0))> // { dg-error "could not convert" } void foo(); struct base {}; struct derived : base {}; void bar() { foo<derived>(); // { dg-error "no matching function" } }