gcc/testsuite/g++.dg/cpp2a/nontype-class22.C
raw| 1 | // PR c++/90100 |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | |
| 4 | template<typename T> |
| 5 | inline constexpr bool is_nontype_list = false; |
| 6 | |
| 7 | template<template<auto...> typename T, auto... NonTypes> |
| 8 | inline constexpr bool is_nontype_list<T<NonTypes...>> = true; |
| 9 | |
| 10 | // works |
| 11 | template<auto...> |
| 12 | struct A {}; |
| 13 | |
| 14 | static_assert(is_nontype_list<A<1, 2, 3>>); |
| 15 | |
| 16 | // fails |
| 17 | struct X { |
| 18 | int v; |
| 19 | }; |
| 20 | |
| 21 | static_assert(is_nontype_list<A<X{1}, X{2}, X{3}>>); |