Debian Codegraph @

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

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