]> granicus.if.org Git - clang/commitdiff
Disable 'auto' type deduction in Objective-C. It likes 'id' a bit too
authorDouglas Gregor <dgregor@apple.com>
Mon, 14 Mar 2011 21:43:30 +0000 (21:43 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 14 Mar 2011 21:43:30 +0000 (21:43 +0000)
much to be useful.

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

lib/Parse/ParseDecl.cpp
test/SemaObjC/auto-objective-c.m [deleted file]

index 450329a655a665ba83410dca72d44bd9c346a9d5..d0e410f9bf4d876b0ac710877a4aa8c496dc5c91 100644 (file)
@@ -1249,7 +1249,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
                                          DiagID, getLang());
       break;
     case tok::kw_auto:
-      if (getLang().CPlusPlus0x || getLang().ObjC2) {
+      if (getLang().CPlusPlus0x) {
         if (isKnownToBeTypeSpecifier(GetLookAheadToken(1))) {
           isInvalid = DS.SetStorageClassSpec(DeclSpec::SCS_auto, Loc, PrevSpec,
                                            DiagID, getLang());
diff --git a/test/SemaObjC/auto-objective-c.m b/test/SemaObjC/auto-objective-c.m
deleted file mode 100644 (file)
index 5467e24..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-// RUN: %clang_cc1 -x objective-c -fblocks -fsyntax-only -verify %s
-
-@interface I
-{
-  id pi;
-}
-- (id) Meth;
-@end
-
-// Objective-C does not support trailing return types, so check we don't get
-// the C++ diagnostic suggesting we forgot one.
-auto noTrailingReturnType(); // expected-error {{'auto' not allowed in function return type}}
-
-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
-
-
-// rdar://9036633
-int main() {
-  auto int auto_i = 7; // expected-warning {{'auto' storage class specifier is redundant and will be removed in future releases}}
-}