mirror of
https://github.com/intel/llvm.git
synced 2026-01-25 01:07:04 +08:00
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
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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}}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user