gcc/testsuite/g++.dg/cpp2a/nontype-class38.C
raw| 1 | // PR c++/95369 |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | |
| 4 | struct S { |
| 5 | int a; |
| 6 | int b; |
| 7 | }; |
| 8 | |
| 9 | struct W { |
| 10 | int i; |
| 11 | S s; |
| 12 | }; |
| 13 | |
| 14 | template <S p> |
| 15 | void fnc() |
| 16 | { |
| 17 | } |
| 18 | |
| 19 | template<S s> struct X { }; |
| 20 | template<W w> struct Y { }; |
| 21 | |
| 22 | void f() |
| 23 | { |
| 24 | fnc<{ .a = 10, .b = 20 }>(); |
| 25 | fnc<{ 10, 20 }>(); |
| 26 | X<{ .a = 1, .b = 2 }> x; |
| 27 | X<{ 1, 2 }> x2; |
| 28 | // Brace elision is likely to be allowed. |
| 29 | Y<{ 1, 2, 3 }> x3; |
| 30 | } |