diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-12-09 01:15:54 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-12-09 01:15:54 +0000 |
commit | 5a477dbf7589f516effe56fa2ed7d4680b5c1094 (patch) | |
tree | 4b2122028b4a9cac95e8a371989c4241806faf8e | |
parent | c6994005dc9f677c831b8e90bdab483cc2197c29 (diff) |
deprecated enum should not warn when used initializing another deprecated enumerator.
// rdar://10535640
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146218 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 4 | ||||
-rw-r--r-- | test/Sema/attr-availability-macosx.c | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 0c5a4879ae..61048f54e4 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -3099,6 +3099,8 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, Decl *EnumDecl) { SourceLocation EqualLoc; ExprResult AssignedVal; + ParsingDeclRAIIObject PD(*this); + if (Tok.is(tok::equal)) { EqualLoc = ConsumeToken(); AssignedVal = ParseConstantExpression(); @@ -3112,6 +3114,8 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, Decl *EnumDecl) { IdentLoc, Ident, attrs.getList(), EqualLoc, AssignedVal.release()); + PD.complete(EnumConstDecl); + EnumConstantDecls.push_back(EnumConstDecl); LastEnumConstDecl = EnumConstDecl; diff --git a/test/Sema/attr-availability-macosx.c b/test/Sema/attr-availability-macosx.c index 2b7c1e06ac..1de26e9e9e 100644 --- a/test/Sema/attr-availability-macosx.c +++ b/test/Sema/attr-availability-macosx.c @@ -15,3 +15,17 @@ void test() { f4(0); // expected-error{{f4' is unavailable: obsoleted in Mac OS X 10.5}} f5(0); // expected-error{{'f5' is unavailable: not available on Mac OS X}} } + +// rdar://10535640 + +enum { + foo __attribute__((availability(macosx,introduced=8.0,deprecated=9.0))) +}; + +enum { + bar __attribute__((availability(macosx,introduced=8.0,deprecated=9.0))) = foo +}; + +enum __attribute__((availability(macosx,introduced=8.0,deprecated=9.0))) { + bar1 = foo +}; |