[cfe-commits] r78323 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaCXX/copy-constructor-error.cpp
Fariborz Jahanian
fjahanian at apple.com
Thu Aug 6 10:22:51 PDT 2009
Author: fjahanian
Date: Thu Aug 6 12:22:51 2009
New Revision: 78323
URL: http://llvm.org/viewvc/llvm-project?rev=78323&view=rev
Log:
After reporting ill-formed copy constructor(12.8.p3)
don't recurs and crash.
Added:
cfe/trunk/test/SemaCXX/copy-constructor-error.cpp
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=78323&r1=78322&r2=78323&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Thu Aug 6 12:22:51 2009
@@ -1344,7 +1344,8 @@
= ToRecordDecl->lookup(ConstructorName);
Con != ConEnd; ++Con) {
CXXConstructorDecl *Constructor = cast<CXXConstructorDecl>(*Con);
- if (Constructor->isConvertingConstructor())
+ if (!Constructor->isInvalidDecl() &&
+ Constructor->isConvertingConstructor())
AddOverloadCandidate(Constructor, &From, 1, CandidateSet,
/*SuppressUserConversions=*/true, ForceRValue);
}
Added: cfe/trunk/test/SemaCXX/copy-constructor-error.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/copy-constructor-error.cpp?rev=78323&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/copy-constructor-error.cpp (added)
+++ cfe/trunk/test/SemaCXX/copy-constructor-error.cpp Thu Aug 6 12:22:51 2009
@@ -0,0 +1,13 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+struct S { // expected-note {{candidate function}}
+ S (S); // expected-error {{copy constructor must pass its first argument by reference}} \\
+ // expected-note {{candidate function}}
+};
+
+S f();
+
+void g() {
+ S a( f() ); // expected-error {{call to constructor of 'a' is ambiguous}}
+}
+
More information about the cfe-commits
mailing list