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