History

Fix crash on invalid code

like on 'enum myenum { L = -1 } L;'. It's a bit tedious as there are two paths (for global vs local symbols), and because the scope and enum_val share same storage.

Michael Matz committed 7 years ago

Commit ef0397c1 parent b0826593 files · +22 −2Browse files

Showing the changes to tests (2 of 3 files). Show all

Unified · Split

2 files
  1. tests/tests2/60_errors_and_warnings.c +6 −0
  2. tests/tests2/60_errors_and_warnings.expect +6 −0
tests/tests2/60_errors_and_warnings.c+6−0
@@ -124,4 +124,10 @@ void f() { _Generic((int const *[]){0}, int:0); } · 123 unmodified lines
124124 void f() { _Generic((int (*(*)(float,char))(double,int)){0}, int:0); }
125125 #elif defined test_array_to_str
126126 void f() { _Generic((int(*)[3]){0}, int:0); }
127+#elif defined test_duplicate_def_1
128+static enum myenum { L = -1 } L;
129+#elif defined test_duplicate_def_2
130+void foo(void) {
131+static enum myenum { L = -1 } L;
132+}
127133 #endif
tests/tests2/60_errors_and_warnings.expect+6−0
@@ -53,3 +53,9 @@ · 52 unmodified lines
5353
5454 [test_array_to_str]
5555 60_errors_and_warnings.c:126: error: type 'int (*)[3]' does not match any association
56+
57+[test_duplicate_def_1]
58+60_errors_and_warnings.c:128: error: redefinition of 'L'
59+
60+[test_duplicate_def_2]
61+60_errors_and_warnings.c:131: error: redeclaration of 'L'

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t