-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[Clang] disallow constexpr with auto and explicit type in C23 #163469
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
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
3856379
[Clang] disallow constexpr with auto and explicit type in C23
a-tarasyuk ab24f85
Merge branch 'main' into fix/163090
a-tarasyuk 2db8948
Merge branch 'main' into fix/163090
a-tarasyuk 6bbca07
add additional test
a-tarasyuk 138c174
Merge branch 'fix/163090' of https://github.com/a-tarasyuk/llvm-proje…
a-tarasyuk f8b9446
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/…
a-tarasyuk a6b55ed
update release notes
a-tarasyuk 9bbce08
update tests
a-tarasyuk 64379c3
Merge branch 'main' into fix/163090
a-tarasyuk a03a7cf
Merge branch 'main' into fix/163090
a-tarasyuk 9e9f328
add check type specifier
a-tarasyuk f3f09ab
Merge branch 'fix/163090' of https://github.com/a-tarasyuk/llvm-proje…
a-tarasyuk 54b23ba
Merge branch 'main' of https://github.com/llvm/llvm-project into fix/…
a-tarasyuk 18ead94
Merge branch 'main' into fix/163090
a-tarasyuk c436eda
Merge branch 'main' into fix/163090
a-tarasyuk 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,3 +130,30 @@ void atomic(void) { | |
void attributes(void) { | ||
auto ident [[clang::annotate("this works")]] = 12; // c17-error {{type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int}} | ||
} | ||
|
||
/** GH163090 */ | ||
constexpr auto int a1 = 0; // c23-error {{illegal storage class on file-scoped variable}} \ | ||
c23-error {{cannot combine with previous 'auto' declaration specifier}} \ | ||
c17-error {{illegal storage class on file-scoped variable}} \ | ||
c17-error {{unknown type name 'constexpr'}} | ||
|
||
constexpr int auto a2 = 0; // c23-error {{cannot combine with previous 'int' declaration specifier}} \ | ||
c17-error {{illegal storage class on file-scoped variable}} \ | ||
c17-error {{unknown type name 'constexpr'}} | ||
|
||
auto int b1 = 0; // c23-error {{illegal storage class on file-scoped variable}} \ | ||
c17-error {{illegal storage class on file-scoped variable}} | ||
|
||
int auto b2 = 0; // c23-error {{cannot combine with previous 'int' declaration specifier}} \ | ||
c17-error {{illegal storage class on file-scoped variable}} | ||
|
||
void f() { | ||
constexpr auto int c1 = 0; // c23-error {{cannot combine with previous 'auto' declaration specifier}} \ | ||
c17-error {{use of undeclared identifier 'constexpr'}} | ||
|
||
constexpr int auto c2 = 0; // c23-error {{cannot combine with previous 'int' declaration specifier}} \ | ||
c17-error {{use of undeclared identifier 'constexpr'}} | ||
|
||
auto int d1 = 0; | ||
int auto d2 = 0; // c23-error {{cannot combine with previous 'int' declaration specifier}} | ||
Comment on lines
+157
to
+158
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is the order of keywords here significant? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've made a separate issue for this: #164121 |
||
} |
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.