When searching for a default constructor or copy constructor, skip constructor templates

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81002 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index 29a7c7f..155005a 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/lib/AST/DeclCXX.cpp
@@ -157,6 +157,11 @@
   DeclContext::lookup_const_iterator Con, ConEnd;
   for (llvm::tie(Con, ConEnd) = this->lookup(ConstructorName);
        Con != ConEnd; ++Con) {
+    // C++ [class.copy]p2:
+    //   A non-template constructor for class X is a copy constructor if [...]
+    if (isa<FunctionTemplateDecl>(*Con))
+      continue;
+
     if (cast<CXXConstructorDecl>(*Con)->isCopyConstructor(Context, 
                                                           FoundTQs)) {
       if (((TypeQuals & QualType::Const) == (FoundTQs & QualType::Const)) ||
@@ -301,6 +306,10 @@
   DeclContext::lookup_const_iterator Con, ConEnd;
   for (llvm::tie(Con, ConEnd) = lookup(ConstructorName);
        Con != ConEnd; ++Con) {
+    // FIXME: In C++0x, a constructor template can be a default constructor.
+    if (isa<FunctionTemplateDecl>(*Con))
+      continue;
+
     CXXConstructorDecl *Constructor = cast<CXXConstructorDecl>(*Con);
     if (Constructor->isDefaultConstructor())
       return Constructor;