From: Fariborz Jahanian Date: Fri, 9 Dec 2011 01:15:54 +0000 (+0000) Subject: deprecated enum should not warn when used initializing another deprecated enumerator. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5a477dbf7589f516effe56fa2ed7d4680b5c1094;p=clang 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 --- 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 +};