gcc/testsuite/g++.dg/ext/char8_t-aliasing-1.C
raw| 1 | // Test that char8_t does not alias with other types when -fchar8_t is enabled. |
| 2 | // { dg-do compile } |
| 3 | // { dg-options "-fstrict-aliasing -Wstrict-aliasing=1 -fchar8_t" } |
| 4 | |
| 5 | extern long l; |
| 6 | char8_t* f() { |
| 7 | return (char8_t*)&l; // { dg-warning "dereferencing type-punned pointer might break strict-aliasing rules" "char8_t" } |
| 8 | } |