2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / torture / pr56302.C
blob08d47982ac0099dd298a51f2071bbe60cc4e0243
1 // PR c++/56302
2 // { dg-do compile }
4 typedef __SIZE_TYPE__ size_t;
5 # define STAP_SDT_ARG_CONSTRAINT        nor
6 # define _SDT_STRINGIFY(x)              #x
7 # define _SDT_ARG_CONSTRAINT_STRING(x)  _SDT_STRINGIFY(x)
8 # define _SDT_ARG(n, x)                 \
9   [_SDT_S##n] "n" ((_SDT_ARGSIGNED (x) ? 1 : -1) * (int) _SDT_ARGSIZE (x)), \
10   [_SDT_A##n] _SDT_ARG_CONSTRAINT_STRING (STAP_SDT_ARG_CONSTRAINT) (_SDT_ARGVAL (x))
11 #define _SDT_ARGARRAY(x)        (__builtin_classify_type (x) == 14      \
12                                  || __builtin_classify_type (x) == 5)
13 # define _SDT_ARGSIGNED(x)      (!_SDT_ARGARRAY (x) \
14                                  && __sdt_type<__typeof (x)>::__sdt_signed)
15 # define _SDT_ARGSIZE(x)        (_SDT_ARGARRAY (x) \
16                                  ? sizeof (void *) : sizeof (x))
17 # define _SDT_ARGVAL(x)         (x)
18 template<typename __sdt_T>
19 struct __sdt_type
21   static const bool __sdt_signed = false;
23 #define __SDT_ALWAYS_SIGNED(T) \
24 template<> struct __sdt_type<T> { static const bool __sdt_signed = true; };
25 __SDT_ALWAYS_SIGNED(signed char)
26 __SDT_ALWAYS_SIGNED(short)
27 __SDT_ALWAYS_SIGNED(int)
28 __SDT_ALWAYS_SIGNED(long)
29 __SDT_ALWAYS_SIGNED(long long)
30 template<typename __sdt_E>
31 struct __sdt_type<__sdt_E[]> : public __sdt_type<__sdt_E *> {};
32 template<typename __sdt_E, size_t __sdt_N>
33 struct __sdt_type<__sdt_E[__sdt_N]> : public __sdt_type<__sdt_E *> {};
35 struct S { char p[8]; };
37 void
38 foo (const S &str)
40   __asm__ __volatile__ ("" : : _SDT_ARG (0, &str));