diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-10-30 01:06:26 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-10-30 01:06:26 +0000 |
| commit | 93513155e73c8c9d3fb1f4cf1874af7e4d934d53 (patch) | |
| tree | b8acd2b0ad94bcec47c162e7e2e5a37099f0c16f /clang | |
| parent | b5488f45db64e9ab643a3003e23a12a543320d43 (diff) | |
| download | bcm5719-llvm-93513155e73c8c9d3fb1f4cf1874af7e4d934d53.tar.gz bcm5719-llvm-93513155e73c8c9d3fb1f4cf1874af7e4d934d53.zip | |
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.
llvm-svn: 117760
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 1 | ||||
| -rw-r--r-- | clang/test/SemaCXX/crashes.cpp | 15 |
2 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 4e4558479aa..616b2a0bf52 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -723,7 +723,6 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity, // PerformCopyInitialization produce the appropriate diagnostic. SemaRef.PerformCopyInitialization(Entity, SourceLocation(), SemaRef.Owned(expr)); - IList->setInit(Index, 0); hadError = true; ++Index; ++StructuredIndex; diff --git a/clang/test/SemaCXX/crashes.cpp b/clang/test/SemaCXX/crashes.cpp index 9da0b82babb..53eecb6c14f 100644 --- a/clang/test/SemaCXX/crashes.cpp +++ b/clang/test/SemaCXX/crashes.cpp @@ -26,3 +26,18 @@ template<typename T> struct a : T { 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}} +}; +} |

