aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-06-29 21:51:31 +0000
committerDouglas Gregor <dgregor@apple.com>2011-06-29 21:51:31 +0000
commit54001c1e6a87b792b0711b822def2b1bfe1ad4a1 (patch)
treef5b7a9ea4e0d29eaef3d53853dd452e6ac4cb5d5 /lib
parente12a11f26b3ae5fca1178d415800b852d8d780ac (diff)
Check for deprecated/unavailable/etc attributes on fields that are
initialized via initializer lists. Fixes <rdar://problem/9694686>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134099 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaInit.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index da20e0e8fd..58565af9ce 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/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);