A constructor template cannot be instantiated to a copy
constructor. Make sure that such declarations can never be formed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88718 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 3948b22..70b080e 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -2237,7 +2237,9 @@
     // argument doesn't participate in overload resolution.
   }
 
-  if (!CandidateSet.isNewCandidate(Function))
+  // FIXME: It would be nice if it were safe to keep invalid methods in the
+  // overload set (but it isn't due to broken copy constructors).
+  if (!CandidateSet.isNewCandidate(Function) || Function->isInvalidDecl())
     return;
     
   // Add this candidate