r346709 - [Sema] Make sure we substitute an instantiation-dependent default template argument
Erik Pilkington via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 12 13:31:06 PST 2018
Author: epilk
Date: Mon Nov 12 13:31:06 2018
New Revision: 346709
URL: http://llvm.org/viewvc/llvm-project?rev=346709&view=rev
Log:
[Sema] Make sure we substitute an instantiation-dependent default template argument
Fixes llvm.org/PR39623
Differential revision: https://reviews.llvm.org/D54414
Modified:
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/SemaCXX/alias-template.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=346709&r1=346708&r2=346709&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Mon Nov 12 13:31:06 2018
@@ -4434,7 +4434,7 @@ SubstDefaultTemplateArgument(Sema &SemaR
// 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));
Modified: cfe/trunk/test/SemaCXX/alias-template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/alias-template.cpp?rev=346709&r1=346708&r2=346709&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/alias-template.cpp (original)
+++ cfe/trunk/test/SemaCXX/alias-template.cpp Mon Nov 12 13:31:06 2018
@@ -179,3 +179,13 @@ struct S {
};
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'}}
+}
More information about the cfe-commits
mailing list