]> granicus.if.org Git - clang/commitdiff
deprecated enum should not warn when used initializing another deprecated enumerator.
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 9 Dec 2011 01:15:54 +0000 (01:15 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 9 Dec 2011 01:15:54 +0000 (01:15 +0000)
// rdar://10535640

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146218 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDecl.cpp
test/Sema/attr-availability-macosx.c

index 0c5a4879aedbe577446d4562a96fa08a3ff8fd85..61048f54e448f225422b1e17364bc2af2cee00a1 100644 (file)
@@ -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;
 
index 2b7c1e06ace7807735b91ed760dd3fce4570b709..1de26e9e9eac70b1699e258013c1a0bebba6dfdd 100644 (file)
@@ -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
+};