Last change
on this file since 960665c was
df2e00f,
checked in by Andrew Beach <ajbeach@…>, 3 months ago
|
Made heap pass the invariant check. We should be able to enable invariants on the standard library. Also added the reproductions for new trac trickets.
|
-
Property mode set to
100644
|
File size:
451 bytes
|
Rev | Line | |
---|
[df2e00f] | 1 | // Trac ticket |
---|
| 2 | // https://cforall.uwaterloo.ca/trac/ticket/289 |
---|
| 3 | // Invariant Failure in Static Assertion |
---|
| 4 | |
---|
| 5 | #define SIZE 5 |
---|
| 6 | |
---|
| 7 | static char array[] = { |
---|
| 8 | 'a', 'b', 'c', 'd', 'e' |
---|
| 9 | }; |
---|
| 10 | |
---|
| 11 | // This pattern is fine: |
---|
| 12 | static_assert( sizeof(array) == SIZE * sizeof(char), "Wrong Array Size" ); |
---|
| 13 | |
---|
| 14 | // This pattern fails invariant checks: |
---|
| 15 | static_assert( SIZE == sizeof(array) / sizeof(array[0]), "Wrong Array Size" ); |
---|
| 16 | |
---|
| 17 | int main(int argc, char * argv) { |
---|
| 18 | printf("done!\n"); |
---|
| 19 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.