[ARC] Allow forming 'id*' in an unevaluated context. Fixes rdar://10148540.

llvm-svn: 140212
This commit is contained in:
Argyrios Kyrtzidis 2011-09-20 23:49:22 +00:00
parent 86364b4521
commit 712512bb36
2 changed files with 7 additions and 0 deletions

View File

@ -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

View File

@ -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