aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/char8_t-aliasing-1.C
blob: 9252ef9dfa652ce1e17620af8aaa45d3072bd277 (plain)
1
2
3
4
5
6
7
8
// Test that char8_t does not alias with other types when -fchar8_t is enabled.
// { dg-do compile }
// { dg-options "-fstrict-aliasing -Wstrict-aliasing=1 -fchar8_t" }

extern long l;
char8_t* f() {
  return (char8_t*)&l; // { dg-warning "dereferencing type-punned pointer might break strict-aliasing rules" "char8_t" }
}