diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-02-20 23:47:12 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-02-20 23:47:12 +0000 |
commit | 148bc6a1f79b0d9a7e6651ce1b2252d0b540db6c (patch) | |
tree | 45bad3545d58343299ca623c5702fd8a1c4a7d4f | |
parent | 00245539b6426f2cb9eca1a418fb1437b5295dcc (diff) | |
download | bcm5719-llvm-148bc6a1f79b0d9a7e6651ce1b2252d0b540db6c.tar.gz bcm5719-llvm-148bc6a1f79b0d9a7e6651ce1b2252d0b540db6c.zip |
Fix assert when template argument deduction's original call arg checking triggers class template instantiation.
llvm-svn: 325646
-rw-r--r-- | clang/lib/Sema/SemaTemplateDeduction.cpp | 2 | ||||
-rw-r--r-- | clang/test/SemaTemplate/temp_arg_pack.cpp | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index d09cf9933ec..53fa8745ee0 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/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/clang/test/SemaTemplate/temp_arg_pack.cpp b/clang/test/SemaTemplate/temp_arg_pack.cpp new file mode 100644 index 00000000000..b79dca78bce --- /dev/null +++ b/clang/test/SemaTemplate/temp_arg_pack.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -verify %s + +namespace deduce_pack_non_pack { + template <typename...> class A; + template <typename> struct C {}; + template <typename T> void g(C<A<T>>); // expected-note {{candidate template ignored: deduced type 'C<A<[...], (no argument)>>' of 1st parameter does not match adjusted type 'C<A<[...], int>>' of argument [with T = bool]}} + void h(C<A<bool, int>> &x) { g(x); } // expected-error {{no matching function}} +} |