-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[C23] Fix handling of alignas (#81637)
In C++, alignas is an attribute specifier, while in C23, it's an alias of _Alignas, which is a type specifier/qualifier. This means that they parse differently in some circumstances. Fixes #81472
- Loading branch information
1 parent
c448bd8
commit b9cf7f1
Showing
6 changed files
with
83 additions
and
39 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
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
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 |
---|---|---|
@@ -1,11 +1,4 @@ | ||
// RUN: %clang_cc1 -std=c23 -fsyntax-only -verify %s | ||
|
||
_Alignas(int) struct c1; // expected-warning {{'_Alignas' attribute ignored}} | ||
|
||
// FIXME: `alignas` enters into C++ parsing code and never reaches the | ||
// declaration specifier attribute diagnostic infrastructure. | ||
// | ||
// Fixing this will require the C23 notions of `alignas` being a keyword and | ||
// `_Alignas` being an alternate spelling integrated into the parsing | ||
// infrastructure. | ||
alignas(int) struct c1; // expected-error {{misplaced attributes; expected attributes here}} | ||
alignas(int) struct c1; // expected-warning {{'alignas' attribute ignored}} |