Turn on 'auto' in plain objc mode.

llvm-svn: 126134
This commit is contained in:
Fariborz Jahanian 2011-02-21 18:37:13 +00:00
parent d0257f79bc
commit 786e04cda5
2 changed files with 25 additions and 1 deletions

View File

@ -1244,7 +1244,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
DiagID, getLang());
break;
case tok::kw_auto:
if (getLang().CPlusPlus0x)
if (getLang().CPlusPlus0x || getLang().ObjC1)
isInvalid = DS.SetTypeSpecType(DeclSpec::TST_auto, Loc, PrevSpec,
DiagID);
else

View File

@ -0,0 +1,24 @@
// RUN: %clang_cc1 -x objective-c -fblocks -fsyntax-only -verify %s
@interface I
{
id pi;
}
- (id) Meth;
@end
typedef int (^P) (int x);
@implementation I
- (id) Meth {
auto p = [pi Meth];
return p;
}
- (P) bfunc {
auto my_block = ^int (int x) {return x; };
my_block(1);
return my_block;
}
@end