[cfe-commits] r117760 - in /cfe/trunk: lib/Sema/SemaInit.cpp test/SemaCXX/crashes.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Fri Oct 29 18:06:26 PDT 2010
Author: akirtzidis
Date: Fri Oct 29 20:06:26 2010
New Revision: 117760
URL: http://llvm.org/viewvc/llvm-project?rev=117760&view=rev
Log:
Don't remove the init expression from the initializer list if it had a semantic error.
We already flag the error with InitListChecker's hadError and we mess up the AST unnecessarily.
Fixes rdar://8605381.
Modified:
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/test/SemaCXX/crashes.cpp
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=117760&r1=117759&r2=117760&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Fri Oct 29 20:06:26 2010
@@ -723,7 +723,6 @@
// PerformCopyInitialization produce the appropriate diagnostic.
SemaRef.PerformCopyInitialization(Entity, SourceLocation(),
SemaRef.Owned(expr));
- IList->setInit(Index, 0);
hadError = true;
++Index;
++StructuredIndex;
Modified: cfe/trunk/test/SemaCXX/crashes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/crashes.cpp?rev=117760&r1=117759&r2=117760&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/crashes.cpp (original)
+++ cfe/trunk/test/SemaCXX/crashes.cpp Fri Oct 29 20:06:26 2010
@@ -26,3 +26,18 @@
int aa() { return p; } // expected-error{{use of undeclared identifier 'p'}}
};
};
+
+// rdar://8605381
+namespace rdar8605381 {
+struct X {};
+
+struct Y { // expected-note{{candidate}}
+ Y();
+};
+
+struct {
+ Y obj;
+} objs[] = {
+ new Y // expected-error{{no viable conversion}}
+};
+}
More information about the cfe-commits
mailing list