Skip to content

Commit f626a30

Browse files
committed
fix tests in temp.constr/temp.constr.normal/p1.cpp
1 parent 14b0e97 commit f626a30

File tree

1 file changed

+33
-13
lines changed
  • clang/test/CXX/temp/temp.constr/temp.constr.normal

1 file changed

+33
-13
lines changed

clang/test/CXX/temp/temp.constr/temp.constr.normal/p1.cpp

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,29 @@
22
// FIXME: RUN: %clang_cc1 -std=c++2c -x c++ -verify %s
33

44
template<typename T> concept True = true;
5-
template<typename T> concept Foo = True<T*>;
6-
template<typename T> concept Bar = Foo<T&>;
7-
template<typename T> requires Bar<T> struct S { };
8-
// FIXME: GCC rejects: https://gcc.godbolt.org/z/c9G7G6PTx if the specialization is present.
5+
template<typename T> concept Foo = True<T*>; // #Foo
6+
template<typename T> concept Bar = Foo<T&>; // #Bar
7+
template<typename T> requires Bar<T> struct S { }; // #S
98
template<typename T> requires Bar<T> && true struct S<T> { };
9+
// expected-error@-1 {{class template partial specialization is not more specialized than the primary template}}
10+
// expected-error@#Foo 2{{'type name' declared as a pointer to a reference of type 'T &'}}
11+
// expected-note@#Foo 2{{while substituting into concept arguments here}}
12+
// expected-note@#Bar 2{{while substituting into concept arguments here}}
13+
// expected-note@#S {{template is declared here}}
14+
15+
1016

1117
template<typename T> concept True2 = sizeof(T) >= 0;
12-
template<typename T> concept Foo2 = True2<T*>;
13-
// expected-error@-1 3{{'type name' declared as a pointer to a reference of type 'type-parameter-0-0 &'}}
14-
template<typename T> concept Bar2 = Foo2<T&>;
18+
template<typename T> concept Foo2 = True2<T*>; // #Foo2
19+
20+
template<typename T> concept Bar2 = Foo2<T&>; // #Bar2
1521
// expected-note@-1 3{{while substituting into concept arguments here; substitution failures not allowed in concept arguments}}
1622
template<typename T> requires Bar2<T> struct S2 { };
1723
// expected-note@-1{{template is declared here}}
1824
template<typename T> requires Bar2<T> && true struct S2<T> { };
1925
// expected-error@-1{{class template partial specialization is not more specialized than the primary template}}
20-
// expected-note@-2{{while calculating associated constraint of template 'S2<T>' here}}
26+
// expected-error@#Foo2{{'type name' declared as a pointer to a reference of type 'T &'}}
27+
2128

2229
namespace type_pack {
2330
template<typename... Args>
@@ -73,16 +80,29 @@ namespace non_type_pack {
7380
namespace PR47174 {
7481
// This checks that we don't crash with a failed substitution on the first constrained argument when
7582
// performing normalization.
76-
template <Bar2 T, True U> // expected-note {{while calculating associated constraint of template 'S3' here}}
83+
template <Bar2 T, True U>
7784
requires true struct S3; // expected-note {{template is declared here}}
7885
template <True T, True U>
79-
requires true struct S3<T, U>; // expected-error {{class template partial specialization is not more specialized than the primary template}}
86+
requires true struct S3<T, U>;
87+
// expected-error@-1 {{class template partial specialization is not more specialized than the primary template}}
88+
// expected-error@#Foo2 2{{'type name' declared as a pointer to a reference of type 'T &'}}
89+
// expected-note@#Foo2 2{{while substituting into concept arguments here}}
90+
// expected-note@#Bar2 {{while substituting into concept arguments here}}
91+
8092

8193
// Same as above, for the second position (but this was already working).
82-
template <True T, Bar2 U> // expected-note {{while calculating associated constraint of template 'S4' here}}
83-
requires true struct S4; // expected-note {{template is declared here}}
94+
template <True T, Bar2 U>
95+
requires true struct S4; // #S4
8496
template <True T, True U>
85-
requires true struct S4<T, U>; // expected-error {{class template partial specialization is not more specialized than the primary template}}
97+
requires true struct S4<T, U>; // #S4-spec
98+
// expected-error@-1 {{class template partial specialization is not more specialized than the primary template}}
99+
// expected-error@#Foo2 {{'type name' declared as a pointer to a reference of type 'U &'}}
100+
// expected-note@#Foo2 2{{while substituting into concept arguments here}}
101+
// expected-note@#S4 {{template is declared here}}
102+
// expected-note@#S4 {{similar constraint expressions not considered equivalent}}
103+
// expected-note@#S4-spec {{similar constraint expression here}}
104+
105+
86106

87107
struct X {
88108
template<int> struct Y {

0 commit comments

Comments
 (0)