erik.pilkington created this revision. erik.pilkington added a reviewer: rsmith. Herald added a subscriber: dexonsmith.
Previously, we'd accept the attached test because we didn't substitute into `void_t` when we really ought to of. Fixes llvm.org/PR39623 Thanks! Repository: rC Clang https://reviews.llvm.org/D54414 Files: clang/lib/Sema/SemaTemplate.cpp clang/test/SemaCXX/alias-template.cpp Index: clang/test/SemaCXX/alias-template.cpp =================================================================== --- clang/test/SemaCXX/alias-template.cpp +++ clang/test/SemaCXX/alias-template.cpp @@ -179,3 +179,13 @@ }; static_assert(__is_same(S<3>::U, X[2]), ""); // expected-error {{static_assert failed}} } + +namespace PR39623 { +template <class T> +using void_t = void; + +template <class T, class = void_t<typename T::wait_what>> +int sfinae_me() { return 0; } // expected-note{{candidate template ignored: substitution failure}} + +int g = sfinae_me<int>(); // expected-error{{no matching function for call to 'sfinae_me'}} +} Index: clang/lib/Sema/SemaTemplate.cpp =================================================================== --- clang/lib/Sema/SemaTemplate.cpp +++ clang/lib/Sema/SemaTemplate.cpp @@ -4434,7 +4434,7 @@ // If the argument type is dependent, instantiate it now based // on the previously-computed template arguments. - if (ArgType->getType()->isDependentType()) { + if (ArgType->getType()->isInstantiationDependentType()) { Sema::InstantiatingTemplate Inst(SemaRef, TemplateLoc, Param, Template, Converted, SourceRange(TemplateLoc, RAngleLoc));
Index: clang/test/SemaCXX/alias-template.cpp =================================================================== --- clang/test/SemaCXX/alias-template.cpp +++ clang/test/SemaCXX/alias-template.cpp @@ -179,3 +179,13 @@ }; static_assert(__is_same(S<3>::U, X[2]), ""); // expected-error {{static_assert failed}} } + +namespace PR39623 { +template <class T> +using void_t = void; + +template <class T, class = void_t<typename T::wait_what>> +int sfinae_me() { return 0; } // expected-note{{candidate template ignored: substitution failure}} + +int g = sfinae_me<int>(); // expected-error{{no matching function for call to 'sfinae_me'}} +} Index: clang/lib/Sema/SemaTemplate.cpp =================================================================== --- clang/lib/Sema/SemaTemplate.cpp +++ clang/lib/Sema/SemaTemplate.cpp @@ -4434,7 +4434,7 @@ // If the argument type is dependent, instantiate it now based // on the previously-computed template arguments. - if (ArgType->getType()->isDependentType()) { + if (ArgType->getType()->isInstantiationDependentType()) { Sema::InstantiatingTemplate Inst(SemaRef, TemplateLoc, Param, Template, Converted, SourceRange(TemplateLoc, RAngleLoc));
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits