1 // { dg-do compile { target c++11 } }
4 int *b = __builtin_launder (); // { dg-error "wrong number of arguments to" }
5 int *c = __builtin_launder (&a, 2); // { dg-error "wrong number of arguments to" }
6 int *d = __builtin_launder (&a);
7 int e = __builtin_launder (a); // { dg-error "non-pointer argument to" }
9 int g = __builtin_launder (f); // { dg-error "non-pointer argument to" }
11 template <typename T> T f1 (T x) { return __builtin_launder (x); } // { dg-error "non-pointer argument to" }
12 template <typename T> T f2 (T x) { return __builtin_launder (x); }
16 struct S { long s; int foo (); } *j;
18 int l = __builtin_launder (j)->foo ();
20 template <typename T> T *f3 (T *x) { return __builtin_launder (x); }
26 template <typename T, typename... U> T *f4 (U... x) { return __builtin_launder (x...); }
27 template <typename T, typename... U> T *f5 (U... x) { return __builtin_launder (x...); } // { dg-error "wrong number of arguments to" }
28 template <typename T, typename... U> T *f6 (U... x) { return __builtin_launder (x...); } // { dg-error "wrong number of arguments to" }
29 template <typename T, typename... U> T f7 (T x, U... y) { return __builtin_launder (x, y...); } // { dg-error "wrong number of arguments to" }
31 long *p = f4<long, long *> (m);
32 long *q = f5<long> ();
33 long *r = f6<long, long *, int> (m, 1);
35 int t = __builtin_launder (&s)->foo ();
37 constexpr const int *f8 (const int *x) { return __builtin_launder (x); }
38 template <typename T> constexpr T f9 (T x) { return __builtin_launder (x); }
40 constexpr const int *v = f8 (&u);
41 constexpr const int *w = f9 (&u);
42 static_assert (*f8 (&u) == 6 && *f9 (&u) == 6, "");