view gcc/testsuite/g++.dg/abi/no_unique_address4.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 [[no_unique_address]] makes the enclosing class non-layout-POD.
// { dg-do compile { target c++11 } }

struct A {};
struct B1: A {
  int i;
  char c;
};

struct B2 {
  [[no_unique_address]] A a;
  int i;
  char c;
};

struct C1: B1 {
  char d;
};

struct C2: B2 {
  char d;
};

#define SA(X) static_assert((X),#X)
SA(sizeof(C1) == sizeof(C2));