-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Type: disallow type specifiers from combining with types specified by…
… typedefed names Closes #731
- Loading branch information
Showing
3 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
typedef long foo; | ||
typedef long foo; | ||
_Static_assert(__builtin_types_compatible_p(long, foo), ""); | ||
|
||
typedef foo bar; | ||
typedef foo bar; | ||
_Static_assert(__builtin_types_compatible_p(bar, foo), ""); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
typedef long foo; | ||
typedef unsigned foo bar; | ||
|
||
typedef double baz; | ||
typedef long baz; | ||
|
||
#define EXPECTED_ERRORS "typedef extra specifiers disallowed.c:2:18: error: typedef redefinition with different types ('unsigned int' vs 'long')" \ | ||
"typedef extra specifiers disallowed.c:1:14: note: previous definition is here" \ | ||
"typedef extra specifiers disallowed.c:2:22: error: expected ';', found 'an identifier'" \ | ||
"typedef extra specifiers disallowed.c:2:22: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]" \ | ||
"typedef extra specifiers disallowed.c:5:14: error: typedef redefinition with different types ('long' vs 'double')" \ | ||
"typedef extra specifiers disallowed.c:4:16: note: previous definition is here" \ | ||
|