"invalid conversion %2 integer '%1', expected block pointer '%0'")
DIAG(err_typecheck_comparison_of_distinct_blocks, ERROR,
"comparison of distinct block types ('%0' and '%1')")
-DIAG(err_typecheck_convert_incompatible_block_pointer, ERROR,
+DIAG(ext_typecheck_convert_incompatible_block_pointer, EXTWARN,
"incompatible block pointer types %2 '%1', expected '%0'")
DIAG(ext_typecheck_convert_pointer_void_block, EXTENSION,
"%2 '%1' converts between void* and block pointer, expected '%0'")
DiagKind = diag::err_int_to_block_pointer;
break;
case IncompatibleBlockPointer:
- DiagKind = diag::err_typecheck_convert_incompatible_block_pointer;
+ DiagKind = diag::ext_typecheck_convert_incompatible_block_pointer;
break;
case BlockVoidPointer:
DiagKind = diag::ext_typecheck_convert_pointer_void_block;
int (*FPL) (int) = FP; // C doesn't consider this an error.
// For Blocks, the ASTContext::typesAreBlockCompatible() makes sure this is an error.
- int (^PFR) (int) = IFP; // expected-error {{incompatible block pointer types initializing 'int (^)()', expected 'int (^)(int)'}}
+ int (^PFR) (int) = IFP; // expected-warning {{incompatible block pointer types initializing 'int (^)()', expected 'int (^)(int)'}}
PFR = II; // OK
- int (^IFP) () = PFR; // expected-error {{incompatible block pointer types initializing 'int (^)(int)', expected 'int (^)()'}}
+ int (^IFP) () = PFR; // expected-warning {{incompatible block pointer types initializing 'int (^)(int)', expected 'int (^)()'}}
- const int (^CIC) () = IFP; // expected-error {{incompatible block pointer types initializing 'int (^)()', expected 'int const (^)()'}}
+ const int (^CIC) () = IFP; // expected-warning {{incompatible block pointer types initializing 'int (^)()', expected 'int const (^)()'}}
const int (^CICC) () = CIC;
int * const (^IPCC1) () = IPCC;
- int * (^IPCC2) () = IPCC; // expected-error {{incompatible block pointer types initializing 'int *const (^)()', expected 'int *(^)()'}}
+ int * (^IPCC2) () = IPCC; // expected-warning {{incompatible block pointer types initializing 'int *const (^)()', expected 'int *(^)()'}}
- int (^IPCC3) (const int) = PFR; // expected-error {{incompatible block pointer types initializing 'int (^)(int)', expected 'int (^)(int const)'}}
+ int (^IPCC3) (const int) = PFR; // expected-warning {{incompatible block pointer types initializing 'int (^)(int)', expected 'int (^)(int const)'}}
int (^IPCC4) (int, char (^CArg) (double));
int (^IPCC5) (int, char (^CArg) (double)) = IPCC4;
- int (^IPCC6) (int, char (^CArg) (float)) = IPCC4; // expected-error {{incompatible block pointer types initializing 'int (^)(int, char (^)(double))', expected 'int (^)(int, char (^)(float))'}}
+ int (^IPCC6) (int, char (^CArg) (float)) = IPCC4; // expected-warning {{incompatible block pointer types initializing 'int (^)(int, char (^)(double))', expected 'int (^)(int, char (^)(float))'}}
IPCC2 = 0;
IPCC2 = 1; // expected-error {{invalid conversion assigning integer 'int', expected block pointer 'int *(^)()'}}
short y;
- short (^add1)(void) = ^{ return y+1; }; // expected-error {{incompatible block pointer types initializing 'int (^)(void)', expected 'short (^)(void)'}}
+ short (^add1)(void) = ^{ return y+1; }; // expected-warning {{incompatible block pointer types initializing 'int (^)(void)', expected 'short (^)(void)'}}
CL X = ^{
if (2)
return (char*)0;
};
- double (^A)(void) = ^ { // expected-error {{incompatible block pointer types initializing 'float (^)(void)', expected 'double (^)(void)'}}
+ double (^A)(void) = ^ { // expected-warning {{incompatible block pointer types initializing 'float (^)(void)', expected 'double (^)(void)'}}
if (1)
return (float)1.0;
else
else
return 2; // expected-error {{incompatible type returning 'int', expected 'char *'}}
};
- return ^{ return 1; }; // expected-error {{incompatible block pointer types returning 'int (^)(void)', expected 'CL'}} expected-error {{returning block that lives on the local stack}}
+ return ^{ return 1; }; // expected-warning {{incompatible block pointer types returning 'int (^)(void)', expected 'CL'}} expected-error {{returning block that lives on the local stack}}
}
typedef int (^CL2)(void);
return (Boolean)(uintptr_t)INVOKE_CALLBACK2(value_equal, (uintptr_t)stack_value_or_key1, (uintptr_t)stack_value_or_key2);
};
}
+
+static int funk(char *s) {
+ return 1;
+}
+void foo4() {
+ int (^xx)(const char *s) = ^(char *s) { return 1; }; // expected-warning {{incompatible block pointer types initializing 'int (^)(char *)', expected 'int (^)(char const *)'}}
+ int (*yy)(const char *s) = funk; // expected-warning {{incompatible pointer types initializing 'int (char *)', expected 'int (*)(char const *)'}}
+}