1 | // RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ -verify %s |
2 | |
3 | namespace nodiag { |
4 | |
5 | template <typename T> requires bool(T()) |
6 | struct A; |
7 | template <typename U> requires bool(U()) |
8 | struct A; |
9 | |
10 | } // end namespace nodiag |
11 | |
12 | namespace diag { |
13 | |
14 | template <typename T> requires true // expected-note{{previous template declaration is here}} |
15 | struct A; |
16 | template <typename T> struct A; // expected-error{{associated constraints differ in template redeclaration}} |
17 | |
18 | template <typename T> struct B; // expected-note{{previous template declaration is here}} |
19 | template <typename T> requires true // expected-error{{associated constraints differ in template redeclaration}} |
20 | struct B; |
21 | |
22 | template <typename T> requires true // expected-note{{previous template declaration is here}} |
23 | struct C; |
24 | template <typename T> requires !0 // expected-error{{associated constraints differ in template redeclaration}} |
25 | struct C; |
26 | |
27 | } // end namespace diag |
28 | |
29 | namespace nodiag { |
30 | |
31 | struct AA { |
32 | template <typename T> requires someFunc(T()) |
33 | struct A; |
34 | }; |
35 | |
36 | template <typename T> requires someFunc(T()) |
37 | struct AA::A { }; |
38 | |
39 | struct AAF { |
40 | template <typename T> requires someFunc(T()) |
41 | friend struct AA::A; |
42 | }; |
43 | |
44 | } // end namespace nodiag |
45 | |
46 | namespace diag { |
47 | |
48 | template <unsigned N> |
49 | struct TA { |
50 | template <template <unsigned> class TT> requires TT<N>::happy // expected-note 2{{previous template declaration is here}} |
51 | struct A; |
52 | |
53 | struct AF; |
54 | }; |
55 | |
56 | template <unsigned N> |
57 | template <template <unsigned> class TT> struct TA<N>::A { }; // expected-error{{associated constraints differ in template redeclaration}} |
58 | |
59 | template <unsigned N> |
60 | struct TA<N>::AF { |
61 | template <template <unsigned> class TT> requires TT<N + 0>::happy // expected-error{{associated constraints differ in template redeclaration}} |
62 | friend struct TA::A; |
63 | }; |
64 | |
65 | } // end namespace diag |
66 | |