зеркало из https://github.com/microsoft/clang-1.git
Fix crash on invalid in microsoft anonymous struct extension.
Fixes PR11847. Patch from Jason Haslam! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149460 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
fe9b559f81
Коммит
ee625afea7
|
@ -2952,9 +2952,10 @@ Decl *Sema::BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS,
|
||||||
SmallVector<NamedDecl*, 2> Chain;
|
SmallVector<NamedDecl*, 2> Chain;
|
||||||
Chain.push_back(Anon);
|
Chain.push_back(Anon);
|
||||||
|
|
||||||
if (InjectAnonymousStructOrUnionMembers(*this, S, CurContext,
|
RecordDecl *RecordDef = Record->getDefinition();
|
||||||
Record->getDefinition(),
|
if (!RecordDef || InjectAnonymousStructOrUnionMembers(*this, S, CurContext,
|
||||||
AS_none, Chain, true))
|
RecordDef, AS_none,
|
||||||
|
Chain, true))
|
||||||
Anon->setInvalidDecl();
|
Anon->setInvalidDecl();
|
||||||
|
|
||||||
return Anon;
|
return Anon;
|
||||||
|
|
|
@ -86,4 +86,13 @@ void pointer_to_integral_type_conv(char* ptr) {
|
||||||
short sh = (short)ptr;
|
short sh = (short)ptr;
|
||||||
ch = (char)ptr;
|
ch = (char)ptr;
|
||||||
sh = (short)ptr;
|
sh = (short)ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UNKNOWN u; // expected-error {{unknown type name 'UNKNOWN'}}
|
||||||
|
} AA;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
AA; // expected-warning {{anonymous structs are a Microsoft extension}}
|
||||||
|
} BB;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче