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

Subversion Repositories openrisc

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

Go to most recent revision | Compare with Previous | Blame | View Log

// PR c++/36089
// { dg-do run }

extern "C" void abort ();

int f ()
{
  const int c(2);
  int d[c] = { 0, 0 };
  return d[0] + sizeof d;
}

struct A
{
  static int f ()
  {
    const int c(2);
    int d[c] = { 0, 0 };
    return d[0] + sizeof d;
  }
};

template <int> struct B
{
  static int f ()
  {
    const int c = 2;
    int d[c] = { 0, 0 };
    return d[0] + sizeof d;
  }
};

template <int> struct C
{
  static int f ()
  {
    const int c(2);
    int d[c] = { 0, 0 };
    return d[0] + sizeof d;
  }
};

template <int> struct D
{
  static int f ()
  {
    const int e(2);
    const int c(e);
    int d[c] = { 0, 0 };
    return d[0] + sizeof d;
  }
};

int
main (void)
{
  int v = f ();
  if (v != 2 * sizeof (int))
    abort ();
  if (v != A::f ())
    abort ();
  if (v != B<6>::f ())
    abort ();
  if (v != C<0>::f ())
    abort ();
  if (v != D<1>::f ())
    abort ();
}

Go to most recent revision | 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.