summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xclang/lib/AST/DeclTemplate.cpp5
-rw-r--r--clang/test/CXX/temp/temp.constr/temp.constr.constr/partial-specializations.cpp17
2 files changed, 21 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index 95a2e26e0df..58ce49aab40 100755
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -483,7 +483,10 @@ static void ProfileTemplateParameterList(ASTContext &C,
if (const auto *TTP = dyn_cast<TemplateTypeParmDecl>(D)) {
ID.AddInteger(1);
ID.AddBoolean(TTP->isParameterPack());
- // TODO: Concepts: profile type-constraints.
+ ID.AddBoolean(TTP->hasTypeConstraint());
+ if (const TypeConstraint *TC = TTP->getTypeConstraint())
+ TC->getImmediatelyDeclaredConstraint()->Profile(ID, C,
+ /*Canonical=*/true);
continue;
}
const auto *TTP = cast<TemplateTemplateParmDecl>(D);
diff --git a/clang/test/CXX/temp/temp.constr/temp.constr.constr/partial-specializations.cpp b/clang/test/CXX/temp/temp.constr/temp.constr.constr/partial-specializations.cpp
index 1ea4da29ee9..9f3c21f9917 100644
--- a/clang/test/CXX/temp/temp.constr/temp.constr.constr/partial-specializations.cpp
+++ b/clang/test/CXX/temp/temp.constr/temp.constr.constr/partial-specializations.cpp
@@ -31,6 +31,23 @@ namespace class_templates
// expected-note@-2{{during template argument deduction for class template partial specialization 'B<T *>' [with T = int *]}}
// expected-note@-3{{during template argument deduction for class template partial specialization 'B<T **>' [with T = int]}}
// expected-note@-4 2{{in instantiation of template class 'class_templates::B<int **>' requested here}}
+
+ template<typename T, typename U = double>
+ concept same_as = is_same<T, U>::value;
+
+ template<same_as<bool> T> requires A<T>::type
+ struct B<T*> {};
+ // expected-note@-1{{previous}}
+
+ template<same_as<bool> T> requires A<T>::type
+ struct B<T*> {};
+ // expected-error@-1{{redefinition}}
+
+ template<same_as T> requires A<T>::type
+ struct B<T*> {};
+
+ template<same_as<int> T> requires A<T>::type
+ struct B<T*> {};
}
namespace variable_templates
OpenPOWER on IntegriCloud