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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [constexpr-ref1.C] - Rev 774

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

// PR c++/49172
// { dg-options -std=c++0x }

#define SA(X) static_assert((X),#X)

constexpr int g() { return 42; };
constexpr int(&rg)() = g; // #1

SA(rg() == 42);

constexpr int i = 24;
constexpr int const& ri = i; // #2

SA(&ri == &i);
SA(ri == 24);

void f()
{
  constexpr int(&rg)() = g; // #1

  SA(rg() == 42);

  constexpr static int i = 24;
  constexpr int const& ri = i; // #2

  SA(&ri == &i);
  SA(ri == 24);
}

template <class T>
void f2()
{
  constexpr int(&rg)() = g; // #1

  SA(rg() == 42);

  constexpr static int i = 24;
  constexpr int const& ri = i; // #2

  SA(&ri == &i);
  SA(ri == 24);
}

template void f2<int>();

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.