OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [template/] [stdarg1.C] - Rev 693

Compare with Previous | Blame | View Log

// PR c++/47022
// { dg-do compile }
// Suppress a warning that is irrelevant to the purpose of this test.
// { dg-options "-Wno-abi" { target arm_eabi } }

#include <cstdarg>

template <typename T>
void
f1 (T *p, va_list ap)
{
  *p = va_arg (ap, long double);
  *p += va_arg (ap, double);
}

template <typename T>
void
f2 (T *p, va_list ap)
{
  *p = __real__ va_arg (ap, _Complex int);
  *p += __imag__ va_arg (ap, _Complex double);
  *p += __imag__ va_arg (ap, _Complex long double);
}

template <typename T>
void
f3 (T *p, va_list ap)
{
  *p = va_arg (ap, T);
}

void
foo (int x, va_list ap)
{
  if (x == 0)
    {
      long double ld;
      f1 (&ld, ap);
    }
  else if (x == 1)
    {
      int i;
      f2 (&i, ap);
    }
  else if (x == 2)
    {
      long double ld;
      f3 (&ld, ap);
    }
  else if (x == 3)
    {
      _Complex double cd;
      f3 (&cd, ap);
    }
}

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.