-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[C2y] Implement WG14 N3409 #130299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[C2y] Implement WG14 N3409 #130299
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8ee44f1
[C2y] Implement WG14 N3409
AaronBallman 5271b8b
Merge remote-tracking branch 'origin/main' into aballman-wg14-n3409
AaronBallman c6a0b3f
Update based on review feedback; fix tests
AaronBallman 12a6de9
Merge remote-tracking branch 'origin/main' into aballman-wg14-n3409
AaronBallman f3f1d9b
Remove bad merge
AaronBallman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,36 @@ | ||
// RUN: %clang_cc1 -verify -std=c2y -pedantic %s | ||
// RUN: %clang_cc1 -verify=pre-c2y -std=c2y -Wpre-c2y-compat %s | ||
// RUN: %clang_cc1 -verify=ext -std=c23 -pedantic %s | ||
// expected-no-diagnostics | ||
|
||
/* WG14 N3409: Clang 21 | ||
* Slay Some Earthly Demons X | ||
* | ||
* Removes the requirement that an expression with type void cannot be used in | ||
* any way. This was making it UB to use a void expression in a _Generic | ||
* selection expression for no good reason, as well as making it UB to cast a | ||
* void expression to void, etc. | ||
*/ | ||
|
||
extern void x; | ||
void foo() { | ||
// FIXME: this is technically an extension before C2y and should be diagnosed | ||
// under -pedantic. | ||
(void)(void)1; | ||
// FIXME: same with this. | ||
x; | ||
_Generic(x, void: 1); /* pre-c2y-warning {{use of incomplete type 'void' in a '_Generic' association is incompatible with C standards before C2y}} | ||
ext-warning {{incomplete type 'void' in a '_Generic' association is a C2y extension}} | ||
*/ | ||
_Generic(x, typeof(x): 1); /* pre-c2y-warning {{use of incomplete type 'typeof (x)' (aka 'void') in a '_Generic' association is incompatible with C standards before C2y}} | ||
ext-warning {{incomplete type 'typeof (x)' (aka 'void') in a '_Generic' association is a C2y extension}} | ||
*/ | ||
(void)_Generic(void, default : 1); /* pre-c2y-warning {{passing a type argument as the first operand to '_Generic' is incompatible with C standards before C2y}} | ||
ext-warning {{passing a type argument as the first operand to '_Generic' is a C2y extension}} | ||
*/ | ||
|
||
// This is not sufficiently important of an extension to warrant a "not | ||
// compatible with standards before C2y" warning, but it is an extension in | ||
// C23 and earlier. | ||
return x; // ext-warning {{void function 'foo' should not return void expression}} | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.