From: Richard Smith Date: Tue, 20 Feb 2018 23:47:12 +0000 (+0000) Subject: Fix assert when template argument deduction's original call arg checking triggers... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=799049fee5238acec7f3d737ea968ede1978cfe6;p=clang Fix assert when template argument deduction's original call arg checking triggers class template instantiation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@325646 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index d09cf9933e..53fa8745ee 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -3084,7 +3084,7 @@ CheckOriginalCallArgDeduction(Sema &S, TemplateDeductionInfo &Info, return Sema::TDK_Success; if (A->isRecordType() && isSimpleTemplateIdType(OriginalParamType) && - S.IsDerivedFrom(SourceLocation(), A, DeducedA)) + S.IsDerivedFrom(Info.getLocation(), A, DeducedA)) return Sema::TDK_Success; return Failed(); diff --git a/test/SemaTemplate/temp_arg_pack.cpp b/test/SemaTemplate/temp_arg_pack.cpp new file mode 100644 index 0000000000..b79dca78bc --- /dev/null +++ b/test/SemaTemplate/temp_arg_pack.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -verify %s + +namespace deduce_pack_non_pack { + template class A; + template struct C {}; + template void g(C>); // expected-note {{candidate template ignored: deduced type 'C>' of 1st parameter does not match adjusted type 'C>' of argument [with T = bool]}} + void h(C> &x) { g(x); } // expected-error {{no matching function}} +}