Add an assertion and a test case, in a fruitless attempt to track down an existing bug

llvm-svn: 81885
This commit is contained in:
Douglas Gregor 2009-09-15 18:26:13 +00:00
parent c25359e1a3
commit 31fae89497
2 changed files with 23 additions and 0 deletions

View File

@ -1244,6 +1244,9 @@ Sema::FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate,
if (!Specialization) if (!Specialization)
return TDK_SubstitutionFailure; return TDK_SubstitutionFailure;
assert(Specialization->getPrimaryTemplate()->getCanonicalDecl() ==
FunctionTemplate->getCanonicalDecl());
// If the template argument list is owned by the function template // If the template argument list is owned by the function template
// specialization, release it. // specialization, release it.
if (Specialization->getTemplateSpecializationArgs() == DeducedArgumentList) if (Specialization->getTemplateSpecializationArgs() == DeducedArgumentList)

View File

@ -26,3 +26,23 @@ void test_X0(int i, float f) {
X0 x0g(f, &i); // expected-error{{no matching constructor}} 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);
}