Skip to content

Commit

Permalink
[clang][Interp] Fix broken test case again
Browse files Browse the repository at this point in the history
Instead of asserting that it's wrong, assert the correct
value.

See the discussion in
a8b5994
  • Loading branch information
tbaederr committed Feb 2, 2024
1 parent a1df10d commit 1f4a5d8
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions clang/test/AST/Interp/c.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,11 @@ int somefunc(int i) {
struct ArrayStruct {
char n[1];
};
struct AA {
char name2[(int)&((struct ArrayStruct*)0)->n - 1]; // expected-warning {{folded to constant array}} \
// pedantic-expected-warning {{folded to constant array}} \
// ref-error {{array size is negative}} \
// pedantic-ref-error {{array size is negative}}
};
_Static_assert(sizeof(struct AA) == 15, ""); // ref-error {{failed}} \
// ref-note {{ == 15}} \
// pedantic-ref-error {{failed}} \
// pedantic-ref-note {{ == 15}}
char name2[(int)&((struct ArrayStruct*)0)->n]; // expected-warning {{folded to constant array}} \
// pedantic-expected-warning {{folded to constant array}} \
// ref-warning {{folded to constant array}} \
// pedantic-ref-warning {{folded to constant array}}
_Static_assert(sizeof(name2) == 0, ""); // expected-error {{failed}} \
// expected-note {{evaluates to}} \
// pedantic-expected-error {{failed}} \
// pedantic-expected-note {{evaluates to}}

0 comments on commit 1f4a5d8

Please sign in to comment.