blob: 9f39d45284016404d605a1bf7815d744dc0b3dcc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// { dg-do compile { target c++20 } }
template <class T, class U> concept same_as = __is_same(T, U);
// this constrained placeholder type should get resolved at parse time
template <class T> same_as<bool> auto x = true;
template <auto V> same_as<int> auto y = V; // { dg-error "constraint" }
template <class>
struct A {
template <auto V> static inline same_as<int> auto z = V; // { dg-error "constraint" }
};
int main() {
x<int>; // { dg-bogus "" }
y<0>; // { dg-bogus "" }
y<'0'>; // { dg-message "required from here" }
A<void>::z<0>; // { dg-bogus "" }
A<void>::z<'0'>; // { dg-message "required from here" }
}
// unsatisfied placeholder type constraint diagnosed at parse time
template <class T> same_as<int> auto w = true; // { dg-error "constraint" }
|