} // end anonymous namespace
/// Evaluate an expression as an lvalue. This can be legitimately called on
-/// expressions which are not glvalues, in two cases:
+/// expressions which are not glvalues, in three cases:
/// * function designators in C, and
/// * "extern void" objects
+/// * @selector() expressions in Objective-C
static bool EvaluateLValue(const Expr *E, LValue &Result, EvalInfo &Info) {
assert(E->isGLValue() || E->getType()->isFunctionType() ||
- E->getType()->isVoidType());
+ E->getType()->isVoidType() || isa<ObjCSelectorExpr>(E));
return LValueExprEvaluator(Info, Result).Visit(E);
}
// pr7390
void f(const SEL& v2) {}
-void g() {
+void g(SEL* _Nonnull);
+void h() {
f(@selector(dealloc));
SEL s = @selector(dealloc);
@selector(dealloc) = s; // expected-error {{expression is not assignable}}
SEL* ps2 = &@selector(dealloc);
+
+ // Shouldn't crash.
+ g(&@selector(foo));
}
+