1// PR c++/47022 2// { dg-do compile } 3// Suppress a warning that is irrelevant to the purpose of this test. 4// { dg-options "-Wno-abi" { target arm_eabi } } 5 6#include <cstdarg> 7 8template <typename T> 9void 10f1 (T *p, va_list ap) 11{ 12 *p = va_arg (ap, long double); 13 *p += va_arg (ap, double); 14} 15 16template <typename T> 17void 18f2 (T *p, va_list ap) 19{ 20 *p = __real__ va_arg (ap, _Complex int); 21 *p += __imag__ va_arg (ap, _Complex double); 22 *p += __imag__ va_arg (ap, _Complex long double); 23} 24 25template <typename T> 26void 27f3 (T *p, va_list ap) 28{ 29 *p = va_arg (ap, T); 30} 31 32void 33foo (int x, va_list ap) 34{ 35 if (x == 0) 36 { 37 long double ld; 38 f1 (&ld, ap); 39 } 40 else if (x == 1) 41 { 42 int i; 43 f2 (&i, ap); 44 } 45 else if (x == 2) 46 { 47 long double ld; 48 f3 (&ld, ap); 49 } 50 else if (x == 3) 51 { 52 _Complex double cd; 53 f3 (&cd, ap); 54 } 55} 56