From: Erik Pilkington Date: Mon, 12 Nov 2018 21:31:06 +0000 (+0000) Subject: [Sema] Make sure we substitute an instantiation-dependent default template argument X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f78993129b8de5baafb0d90aa59747d480be915d;p=clang [Sema] Make sure we substitute an instantiation-dependent default template argument Fixes llvm.org/PR39623 Differential revision: https://reviews.llvm.org/D54414 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346709 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index fb792b7539..a4da62b6cb 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -4434,7 +4434,7 @@ SubstDefaultTemplateArgument(Sema &SemaRef, // 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)); diff --git a/test/SemaCXX/alias-template.cpp b/test/SemaCXX/alias-template.cpp index b6256103ef..f2ba04df78 100644 --- a/test/SemaCXX/alias-template.cpp +++ b/test/SemaCXX/alias-template.cpp @@ -179,3 +179,13 @@ struct S { }; static_assert(__is_same(S<3>::U, X[2]), ""); // expected-error {{static_assert failed}} } + +namespace PR39623 { +template +using void_t = void; + +template > +int sfinae_me() { return 0; } // expected-note{{candidate template ignored: substitution failure}} + +int g = sfinae_me(); // expected-error{{no matching function for call to 'sfinae_me'}} +}