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