diff options
| author | Douglas Gregor <dgregor@apple.com> | 2009-09-15 18:26:13 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2009-09-15 18:26:13 +0000 |
| commit | 31fae894977943930d22d02c9663ca18c8bc1e68 (patch) | |
| tree | 07c8cc69209b01366f874a2762fcac7ecf7d8d2e /clang | |
| parent | c25359e1a30d7422ba8f56bb0f385a6de45e7bc9 (diff) | |
| download | bcm5719-llvm-31fae894977943930d22d02c9663ca18c8bc1e68.tar.gz bcm5719-llvm-31fae894977943930d22d02c9663ca18c8bc1e68.zip | |
Add an assertion and a test case, in a fruitless attempt to track down an existing bug
llvm-svn: 81885
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaTemplateDeduction.cpp | 3 | ||||
| -rw-r--r-- | clang/test/SemaTemplate/constructor-template.cpp | 20 |
2 files changed, 23 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index da64b55d823..24246e57348 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -1244,6 +1244,9 @@ Sema::FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate, if (!Specialization) return TDK_SubstitutionFailure; + assert(Specialization->getPrimaryTemplate()->getCanonicalDecl() == + FunctionTemplate->getCanonicalDecl()); + // If the template argument list is owned by the function template // specialization, release it. if (Specialization->getTemplateSpecializationArgs() == DeducedArgumentList) diff --git a/clang/test/SemaTemplate/constructor-template.cpp b/clang/test/SemaTemplate/constructor-template.cpp index 5a2630c2cff..41b0d29cf83 100644 --- a/clang/test/SemaTemplate/constructor-template.cpp +++ b/clang/test/SemaTemplate/constructor-template.cpp @@ -26,3 +26,23 @@ void test_X0(int i, float f) { X0 x0g(f, &i); // expected-error{{no matching constructor}} } + +template<typename T> +struct X1 { + X1(const X1&); + template<typename U> X1(const X1<U>&); +}; + +template<typename T> +struct Outer { + typedef X1<T> A; + + A alloc; + + explicit Outer(const A& a) : alloc(a) { } +}; + +void test_X1(X1<int> xi) { + Outer<int> oi(xi); + Outer<float> of(xi); +} |

