Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/cpp1z/launder5.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
rev | line source |
---|---|
111 | 1 // { dg-do run { target c++11 } } |
2 // { dg-additional-options "-O2" } | |
3 // { dg-additional-sources "launder5.cc" } | |
4 | |
5 #include <cassert> | |
6 #include "launder5.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 | |
19 int | |
20 main () | |
21 { | |
22 B b{{42}}; | |
23 f(b); | |
24 assert(std::launder(&b.a)->x == 666); | |
25 } |