an enum must be compatible with one or more integer type, so adjust the test accordingly. That means the following redeclarations should work: enum e6 { E1 = -1, E0 }; void f3(enum e6); void f3(int); // should work as int and e6 are compatible while the following should not: void f4(enum e6 e); void f4(unsigned e); // should error as unsigned and e6 are incompatible
Showing the changes to tests (2 of 3 files). Show all
Unified · Split
| @@ -118,6 +118,13 @@ enum e5; · 117 unmodified lines | |||
| 118 | void f3(enum e4 e); | 118 | void f3(enum e4 e); |
| 119 | void f3(enum e5 e); | 119 | void f3(enum e5 e); |
| 120 | 120 | ||
| 121 | #elif defined test_enum_compat_2 | ||
| 122 | enum e6 { E1 = -1, E0 }; | ||
| 123 | void f3(enum e6); | ||
| 124 | void f3(int); // should work as int and e6 are compatible | ||
| 125 | void f4(enum e6 e); | ||
| 126 | void f4(unsigned e); // should error as unsigned and e6 are incompatible | ||
| 127 | |||
| 121 | #elif defined test_ptr_to_str | 128 | #elif defined test_ptr_to_str |
| 122 | void f() { _Generic((int const *[]){0}, int:0); } | 129 | void f() { _Generic((int const *[]){0}, int:0); } |
| 123 | #elif defined test_fnptr_to_str | 130 | #elif defined test_fnptr_to_str |
| @@ -46,73 +46,76 @@ · 45 unmodified lines | |||
| 46 | [test_enum_compat] | 46 | [test_enum_compat] |
| 47 | 60_errors_and_warnings.c:119: error: incompatible types for redefinition of 'f3' | 47 | 60_errors_and_warnings.c:119: error: incompatible types for redefinition of 'f3' |
| 48 | 48 | ||
| 49 | [test_enum_compat_2] | ||
| 50 | 60_errors_and_warnings.c:126: error: incompatible types for redefinition of 'f4' | ||
| 51 | |||
| 49 | [test_ptr_to_str] | 52 | [test_ptr_to_str] |
| 50 | 60_errors_and_warnings.c:122: error: type 'const int **' does not match any association | 53 | 60_errors_and_warnings.c:129: error: type 'const int **' does not match any association |
| 51 | 54 | ||
| 52 | [test_fnptr_to_str] | 55 | [test_fnptr_to_str] |
| 53 | 60_errors_and_warnings.c:124: error: type 'int (*(*)(float, char))(double, int)' does not match any association | 56 | 60_errors_and_warnings.c:131: error: type 'int (*(*)(float, char))(double, int)' does not match any association |
| 54 | 57 | ||
| 55 | [test_array_to_str] | 58 | [test_array_to_str] |
| 56 | 60_errors_and_warnings.c:126: error: type 'int (*)[3]' does not match any association | 59 | 60_errors_and_warnings.c:133: error: type 'int (*)[3]' does not match any association |
| 57 | 60 | ||
| 58 | [test_duplicate_def_1] | 61 | [test_duplicate_def_1] |
| 59 | 60_errors_and_warnings.c:128: error: redefinition of 'L' | 62 | 60_errors_and_warnings.c:135: error: redefinition of 'L' |
| 60 | 63 | ||
| 61 | [test_duplicate_def_2] | 64 | [test_duplicate_def_2] |
| 62 | 60_errors_and_warnings.c:131: error: redeclaration of 'L' | 65 | 60_errors_and_warnings.c:138: error: redeclaration of 'L' |
| 63 | 66 | ||
| 64 | [test_abstract_decls] | 67 | [test_abstract_decls] |
| 65 | 60_errors_and_warnings.c:141: error: identifier expected | 68 | 60_errors_and_warnings.c:148: error: identifier expected |
| 66 | 69 | ||
| 67 | [test_invalid_1] | 70 | [test_invalid_1] |
| 68 | 60_errors_and_warnings.c:146: error: identifier expected | 71 | 60_errors_and_warnings.c:153: error: identifier expected |
| 69 | 72 | ||
| 70 | [test_invalid_2] | 73 | [test_invalid_2] |
| 71 | 60_errors_and_warnings.c:149: error: ';' expected (got "{") | 74 | 60_errors_and_warnings.c:156: error: ';' expected (got "{") |
| 72 | 75 | ||
| 73 | [test_invalid_3] | 76 | [test_invalid_3] |
| 74 | 60_errors_and_warnings.c:153: error: ',' expected (got "a") | 77 | 60_errors_and_warnings.c:160: error: ',' expected (got "a") |
| 75 | 78 | ||
| 76 | [test_invalid_4] | 79 | [test_invalid_4] |
| 77 | 60_errors_and_warnings.c:157: error: division by zero in constant | 80 | 60_errors_and_warnings.c:164: error: division by zero in constant |
| 78 | 81 | ||
| 79 | [test_conflicting_types] | 82 | [test_conflicting_types] |
| 80 | 60_errors_and_warnings.c:163: error: incompatible types for redefinition of 'i' | 83 | 60_errors_and_warnings.c:170: error: incompatible types for redefinition of 'i' |
| 81 | 84 | ||
| 82 | [test_nested_types] | 85 | [test_nested_types] |
| 83 | 60_errors_and_warnings.c:170: error: struct/union/enum already defined | 86 | 60_errors_and_warnings.c:177: error: struct/union/enum already defined |
| 84 | 87 | ||
| 85 | [test_vla_1] | 88 | [test_vla_1] |
| 86 | 60_errors_and_warnings.c:177: error: need explicit inner array size in VLAs | 89 | 60_errors_and_warnings.c:184: error: need explicit inner array size in VLAs |
| 87 | 90 | ||
| 88 | [test_invalid_alignas] | 91 | [test_invalid_alignas] |
| 89 | 60_errors_and_warnings.c:181: error: identifier expected | 92 | 60_errors_and_warnings.c:188: error: identifier expected |
| 90 | 93 | ||
| 91 | [test_static_assert] | 94 | [test_static_assert] |
| 92 | 60_errors_and_warnings.c:187: error: ONE is not 1 | 95 | 60_errors_and_warnings.c:194: error: ONE is not 1 |
| 93 | 96 | ||
| 94 | [test_static_assert_2] | 97 | [test_static_assert_2] |
| 95 | 60_errors_and_warnings.c:191: error: 0 is 0 | 98 | 60_errors_and_warnings.c:198: error: 0 is 0 |
| 96 | 99 | ||
| 97 | [test_static_assert_c2x] | 100 | [test_static_assert_c2x] |
| 98 | 60_errors_and_warnings.c:195: error: _Static_assert fail | 101 | 60_errors_and_warnings.c:202: error: _Static_assert fail |
| 99 | 102 | ||
| 100 | [test_void_array] | 103 | [test_void_array] |
| 101 | 60_errors_and_warnings.c:198: error: declaration of an array of incomplete type elements | 104 | 60_errors_and_warnings.c:205: error: declaration of an array of incomplete type elements |
| 102 | 105 | ||
| 103 | [test_incomplete_enum_array] | 106 | [test_incomplete_enum_array] |
| 104 | 60_errors_and_warnings.c:201: error: declaration of an array of incomplete type elements | 107 | 60_errors_and_warnings.c:208: error: declaration of an array of incomplete type elements |
| 105 | 108 | ||
| 106 | [test_incomplete_struct_array] | 109 | [test_incomplete_struct_array] |
| 107 | 60_errors_and_warnings.c:204: error: declaration of an array of incomplete type elements | 110 | 60_errors_and_warnings.c:211: error: declaration of an array of incomplete type elements |
| 108 | 111 | ||
| 109 | [test_const_fun_array] | 112 | [test_const_fun_array] |
| 110 | 60_errors_and_warnings.c:208: error: declaration of an array of functions | 113 | 60_errors_and_warnings.c:215: error: declaration of an array of functions |
| 111 | 114 | ||
| 112 | [test_incomplete_array_array] | 115 | [test_incomplete_array_array] |
| 113 | 116 | ||
| 114 | [test_extern_array] | 117 | [test_extern_array] |
| 115 | 60_errors_and_warnings.c:224: error: incompatible types for redefinition of 'x' | 118 | 60_errors_and_warnings.c:231: error: incompatible types for redefinition of 'x' |
| 116 | 119 | ||
| 117 | [test_func_1] | 120 | [test_func_1] |
| 118 | hello: a = 123 | 121 | hello: a = 123 |
| @@ -121,17 +124,17 @@ hello: a = 123 · 2 unmodified lines | |||
| 121 | hello: a = 123 | 124 | hello: a = 123 |
| 122 | 125 | ||
| 123 | [test_func_3] | 126 | [test_func_3] |
| 124 | 60_errors_and_warnings.c:254: warning: static storage ignored for redefinition of 'hello' | 127 | 60_errors_and_warnings.c:261: warning: static storage ignored for redefinition of 'hello' |
| 125 | hello: a = 123 | 128 | hello: a = 123 |
| 126 | 129 | ||
| 127 | [test_func_4] | 130 | [test_func_4] |
| 128 | hello: a = 123 | 131 | hello: a = 123 |
| 129 | 132 | ||
| 130 | [test_func_5] | 133 | [test_func_5] |
| 131 | 60_errors_and_warnings.c:254: error: incompatible types for redefinition of 'hello' | 134 | 60_errors_and_warnings.c:261: error: incompatible types for redefinition of 'hello' |
| 132 | 135 | ||
| 133 | [test_func_6] | 136 | [test_func_6] |
| 134 | 60_errors_and_warnings.c:242: error: function without file scope cannot be static | 137 | 60_errors_and_warnings.c:249: error: function without file scope cannot be static |
| 135 | 138 | ||
| 136 | [test_var_1] | 139 | [test_var_1] |
| 137 | main : 1 ; 1 | 140 | main : 1 ; 1 |
| @@ -144,12 +147,12 @@ main : 2 ; 2 · 6 unmodified lines | |||
| 144 | bar : 3 ; 3 | 147 | bar : 3 ; 3 |
| 145 | 148 | ||
| 146 | [test_var_3] | 149 | [test_var_3] |
| 147 | 60_errors_and_warnings.c:286: error: incompatible types for redefinition of 'xxx' | 150 | 60_errors_and_warnings.c:293: error: incompatible types for redefinition of 'xxx' |
| 148 | 151 | ||
| 149 | [test_var_4] | 152 | [test_var_4] |
| 150 | 153 | ||
| 151 | [test_long_double_type_for_win32] | 154 | [test_long_double_type_for_win32] |
| 152 | 60_errors_and_warnings.c:317: warning: assignment from incompatible pointer type | 155 | 60_errors_and_warnings.c:324: warning: assignment from incompatible pointer type |
| 153 | 156 | ||
| 154 | [test_stray_backslash] | 157 | [test_stray_backslash] |
| 155 | 60_errors_and_warnings.c:323: error: stray '\' in program | 158 | 60_errors_and_warnings.c:330: error: stray '\' in program |