-
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.
[clang][Interp] Reject bitcasts to atomic types
The current interpreter does this, so follow suit to match its diagnostics.
- Loading branch information
Showing
5 changed files
with
34 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify=both,expected %s | ||
// RUN: %clang_cc1 -verify=both,ref %s | ||
|
||
/// FIXME: Copied from test/Sema/atomic-expr.c. | ||
/// this expression seems to be rejected for weird reasons, | ||
/// but we imitate the current interpreter's behavior. | ||
_Atomic int ai = 0; | ||
// FIXME: &ai is an address constant, so this should be accepted as an | ||
// initializer, but the bit-cast inserted due to the pointer conversion is | ||
// tripping up the test for whether the initializer is a constant expression. | ||
// The warning is correct but the error is not. | ||
_Atomic(int *) aip3 = &ai; // both-warning {{incompatible pointer types initializing '_Atomic(int *)' with an expression of type '_Atomic(int) *'}} \ | ||
// both-error {{initializer element is not a compile-time constant}} |
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