-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang][ExprConst] Can't be past an invalid LValue designator (#84293)
For the test case in C, both `LV.getLValueOffset()` and `Ctx.getTypeSizeInChars(Ty)` are zero, so we return `true` from `isOnePastTheEndOfCompleteObject()` and ultimately diagnose this as being one past the end, but the diagnostic doesn't make sense.
- Loading branch information
Showing
4 changed files
with
23 additions
and
5 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,14 @@ | ||
// RUN: %clang_cc1 -x c -fsyntax-only %s -verify=c | ||
// RUN: %clang_cc1 -x c -fsyntax-only %s -pedantic -verify=c-pedantic | ||
// | ||
// RUN: %clang_cc1 -x c++ -fsyntax-only %s -verify=cxx | ||
// RUN: %clang_cc1 -x c++ -fsyntax-only %s -pedantic -verify=cxx-pedantic | ||
|
||
// c-no-diagnostics | ||
// cxx-no-diagnostics | ||
|
||
void f(void); | ||
struct S {char c;} s; | ||
_Static_assert(&s != (void *)&f, ""); // c-pedantic-warning {{not an integer constant expression}} \ | ||
// c-pedantic-note {{this conversion is not allowed in a constant expression}} \ | ||
// cxx-pedantic-warning {{'_Static_assert' is a C11 extension}} |