diff options
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index da20e0e8fde..58565af9cee 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -1184,6 +1184,15 @@ void InitListChecker::CheckStructUnionTypes(const InitializedEntity &Entity, continue; } + // Make sure we can use this declaration. + if (SemaRef.DiagnoseUseOfDecl(*Field, + IList->getInit(Index)->getLocStart())) { + ++Index; + ++Field; + hadError = true; + continue; + } + InitializedEntity MemberEntity = InitializedEntity::InitializeMember(*Field, &Entity); CheckSubElementType(MemberEntity, IList, Field->getType(), Index, @@ -1503,6 +1512,12 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity, StructuredList->setInitializedFieldInUnion(*Field); } + // Make sure we can use this declaration. + if (SemaRef.DiagnoseUseOfDecl(*Field, D->getFieldLoc())) { + ++Index; + return true; + } + // Update the designator with the field declaration. D->setField(*Field); |