forked from OSchip/llvm-project
parent
0721c2c155
commit
88fead8c48
|
@ -1423,6 +1423,8 @@ def err_typecheck_expect_scalar_operand : Error<
|
|||
"operand of type %0 where arithmetic or pointer type is required">;
|
||||
def err_typecheck_cond_incompatible_operands : Error<
|
||||
"incompatible operand types (%0 and %1)">;
|
||||
def err_cast_selector_expr : Error<
|
||||
"cannot type cast @selector expression">;
|
||||
def warn_typecheck_cond_incompatible_pointers : Warning<
|
||||
"pointer type mismatch (%0 and %1)">;
|
||||
def warn_typecheck_cond_pointer_integer_mismatch : Warning<
|
||||
|
|
|
@ -2820,6 +2820,8 @@ bool Sema::CheckCastTypes(SourceRange TyR, QualType castType, Expr *&castExpr) {
|
|||
diag::err_cast_pointer_to_non_pointer_int)
|
||||
<< castType << castExpr->getSourceRange();
|
||||
}
|
||||
if (isa<ObjCSelectorExpr>(castExpr))
|
||||
return Diag(castExpr->getLocStart(), diag::err_cast_selector_expr);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
// RUN: clang-cc -fsyntax-only -verify %s
|
||||
|
||||
@interface Foo
|
||||
- (char*) foo;
|
||||
- (void) bar;
|
||||
@end
|
||||
|
||||
@implementation Foo
|
||||
- (void) bar
|
||||
{
|
||||
}
|
||||
|
||||
- (char*) foo
|
||||
{
|
||||
char* a,b,c;
|
||||
a = (char*)@selector(bar); // expected-error {{cannot type cast @selector expression}}
|
||||
return (char*)@selector(bar); // expected-error {{cannot type cast @selector expression}}
|
||||
}
|
||||
@end
|
||||
|
Loading…
Reference in New Issue