view gcc/testsuite/g++.dg/ext/char8_t-aliasing-1.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

// 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" }
}