summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/temp/temp.constr/temp.constr.normal/p1.cpp
diff options
context:
space:
mode:
authorSaar Raz <saar@raz.email>2019-12-23 08:37:35 +0200
committerSaar Raz <saar@raz.email>2019-12-23 08:37:35 +0200
commitdf061c3e2b97974f9e2d72a023eb1c5b987010bc (patch)
tree9e429be93cdfbb8dd82b472361d92083f3f70d5a /clang/test/CXX/temp/temp.constr/temp.constr.normal/p1.cpp
parent1562511275fe1f002458194c085216cf9ae36d1f (diff)
downloadbcm5719-llvm-df061c3e2b97974f9e2d72a023eb1c5b987010bc.tar.gz
bcm5719-llvm-df061c3e2b97974f9e2d72a023eb1c5b987010bc.zip
[Concepts] Constrained partial specializations and function overloads.
Added support for constraint satisfaction checking and partial ordering of constraints in constrained partial specialization and function template overloads. Re-commit after fixing another crash (added regression test). Differential Revision: https://reviews.llvm.org/D41910
Diffstat (limited to 'clang/test/CXX/temp/temp.constr/temp.constr.normal/p1.cpp')
-rw-r--r--clang/test/CXX/temp/temp.constr/temp.constr.normal/p1.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/CXX/temp/temp.constr/temp.constr.normal/p1.cpp b/clang/test/CXX/temp/temp.constr/temp.constr.normal/p1.cpp
new file mode 100644
index 00000000000..387b75c4ef0
--- /dev/null
+++ b/clang/test/CXX/temp/temp.constr/temp.constr.normal/p1.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -std=c++2a -fconcepts-ts -x c++ -verify %s
+
+template<typename T> concept True = true;
+template<typename T> concept Foo = True<T*>;
+template<typename T> concept Bar = Foo<T&>;
+template<typename T> requires Bar<T> struct S { };
+template<typename T> requires Bar<T> && true struct S<T> { };
+
+template<typename T> concept True2 = sizeof(T) >= 0;
+template<typename T> concept Foo2 = True2<T*>;
+// expected-error@-1{{'type name' declared as a pointer to a reference of type 'type-parameter-0-0 &'}}
+template<typename T> concept Bar2 = Foo2<T&>;
+// expected-note@-1{{while substituting into concept arguments here; substitution failures not allowed in concept arguments}}
+template<typename T> requires Bar2<T> struct S2 { };
+// expected-note@-1{{template is declared here}}
+template<typename T> requires Bar2<T> && true struct S2<T> { };
+// expected-error@-1{{class template partial specialization is not more specialized than the primary template}}
+// expected-note@-2{{while calculating associated constraint of template 'S2' here}}
OpenPOWER on IntegriCloud