diff options
-rw-r--r-- | lib/Sema/SemaType.cpp | 5 | ||||
-rw-r--r-- | test/SemaObjC/arc.m | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index ee8e52d22e..6b98ed8721 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -1038,6 +1038,11 @@ static QualType inferARCLifetimeForPointee(Sema &S, QualType type, } else if (type->isObjCARCImplicitlyUnretainedType()) { implicitLifetime = Qualifiers::OCL_ExplicitNone; + // If we are in an unevaluated context, like sizeof, assume ExplicitNone and + // don't give error. + } else if (S.ExprEvalContexts.back().Context == Sema::Unevaluated) { + implicitLifetime = Qualifiers::OCL_ExplicitNone; + // If that failed, give an error and recover using __autoreleasing. } else { // These types can show up in private ivars in system headers, so diff --git a/test/SemaObjC/arc.m b/test/SemaObjC/arc.m index 15ce0e2f6e..054e2bd9b0 100644 --- a/test/SemaObjC/arc.m +++ b/test/SemaObjC/arc.m @@ -646,6 +646,8 @@ void test37(Test37 *c) { for (id y in c) { // expected-error {{collection expression type 'Test37' is a forward declaration}} (void) y; } + + (void)sizeof(id*); // no error. } // rdar://problem/9887979 |