]> granicus.if.org Git - clang/commitdiff
Add an assertion and a test case, in a fruitless attempt to track down an existing bug
authorDouglas Gregor <dgregor@apple.com>
Tue, 15 Sep 2009 18:26:13 +0000 (18:26 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 15 Sep 2009 18:26:13 +0000 (18:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81885 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplateDeduction.cpp
test/SemaTemplate/constructor-template.cpp

index da64b55d82323022ba458cfc42dbd700fa37cfbe..24246e57348ec319ebadc2a6ca818ccaf5e7d252 100644 (file)
@@ -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)
index 5a2630c2cff8f58335d358438fa5411a24ada83d..41b0d29cf83a74196edbe263c16b0d642e335227 100644 (file)
@@ -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);
+}