-
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] Diagnose comparisons with weak pointers
- Loading branch information
Showing
2 changed files
with
27 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,15 @@ | ||
// RUN: %clang_cc1 -std=c++20 -fexperimental-new-constant-interpreter -verify=expected,both %s | ||
// RUN: %clang_cc1 -std=c++20 -verify=ref,both %s | ||
|
||
|
||
|
||
|
||
/// FIXME: The new interpreter also emits the "address of weak declaration" note in the pointer-to-bool case. | ||
|
||
[[gnu::weak]] extern int a; | ||
int ha[(bool)&a]; // both-warning {{variable length arrays in C++ are a Clang extension}} \ | ||
// expected-note {{comparison against address of weak declaration}} \ | ||
// both-error {{variable length array declaration not allowed at file scope}} | ||
int ha2[&a == nullptr]; // both-warning {{variable length arrays in C++ are a Clang extension}} \ | ||
// both-note {{comparison against address of weak declaration '&a' can only be performed at runtime}} \ | ||
// both-error {{variable length array declaration not allowed at file scope}} |