rsmith added inline comments.
================ Comment at: clang/lib/Sema/SemaTemplateInstantiate.cpp:138-144 + bool SkipForSpecialization, + bool ForConstraintInstantiation) { if (!ClassTemplSpec->isClassScopeExplicitSpecialization()) { // We're done when we hit an explicit specialization. if (ClassTemplSpec->getSpecializationKind() == TSK_ExplicitSpecialization && - !isa<ClassTemplatePartialSpecializationDecl>(ClassTemplSpec)) + !isa<ClassTemplatePartialSpecializationDecl>(ClassTemplSpec) && + !ForConstraintInstantiation) ---------------- rsmith wrote: > It seems to me that a namespace-scope explicit specialization shouldn't pick > up template arguments, even during constraint checking: > > ``` > template<typename T> struct A {}; > template<> struct A<int> { > template<typename U> void f() requires U::value; > }; > ``` > Constraint checking for `A<X>::f<Y>` should produce a single level of > template arguments, `<Y>`, not two layers `<X>, <Y>`, because `U` in > `U::value` is a depth-0 index-0 parameter. Complete testcase: ``` struct X {}; struct Y { static constexpr bool value = true; }; template<typename T> struct A {}; template<> struct A<X> { template<typename U> void f() requires U::value; }; void g(A<X> a) { a.f<Y>(); } ``` CHANGES SINCE LAST ACTION https://reviews.llvm.org/D149264/new/ https://reviews.llvm.org/D149264 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits