forked from OSchip/llvm-project
[ARC] Allow forming 'id*' in an unevaluated context. Fixes rdar://10148540.
llvm-svn: 140212
This commit is contained in:
parent
86364b4521
commit
712512bb36
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue