Debian Codegraph @

gcc/testsuite/g++.dg/cpp1z/launder6.C

raw
1 // { dg-do run { target c++11 } }
2 // { dg-additional-options "-O2" }
3 // { dg-additional-sources "launder6.cc" }
4 // { dg-skip-if "requires hosted libstdc++ for cassert" { ! hostedlib } }
5 #include <cassert>
6 #include "launder6.h"
7
8 namespace std
9 {
10 template <typename T>
11 T *
12 launder (T *p)
13 {
14 return __builtin_launder (p);
15 }
16 }
17
18 int
19 main ()
20 {
21 int x = 42;
22 B b{{x}};
23 f(b);
24 assert(std::launder(&b.a)->x == 666);
25 }