]> granicus.if.org Git - clang/commitdiff
[Sema] Make sure we substitute an instantiation-dependent default template argument
authorErik Pilkington <erik.pilkington@gmail.com>
Mon, 12 Nov 2018 21:31:06 +0000 (21:31 +0000)
committerErik Pilkington <erik.pilkington@gmail.com>
Mon, 12 Nov 2018 21:31:06 +0000 (21:31 +0000)
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

lib/Sema/SemaTemplate.cpp
test/SemaCXX/alias-template.cpp

index fb792b7539c98e758b54f925ce47169f78c39bae..a4da62b6cb4c601dcdb01948ed5fd389d8327339 100644 (file)
@@ -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));
index b6256103ef8d22101c759e685cf6b2340530a820..f2ba04df78ae238ef405f9b662a91a64ac8502fb 100644 (file)
@@ -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'}}
+}