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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.mike/] [p5840.C] - Rev 338

Compare with Previous | Blame | View Log

// { dg-do run  }
// prms-id: 5840

class Signal {
public:
  int Name(void) { return 1; }
};

class Derived : public Signal {
public:
  int Name(void) { return 2; }
};

template <class Foo , int (Foo::*Id)(void)>
class Bar
{
public:
  int value (Foo* a) { return (a->*Id)(); }
};

/* The following line is illegal under the new rules for non-type
   template arguments in the standard, so it is commented out.  */
/* template class Bar <Derived, &Signal::Name>; */
template class Bar <Signal, &Signal::Name>;
template class Bar <Derived, &Derived::Name>;

Derived a;

/* Bar<Derived, &Signal::Name> dispatcher1; */
Bar<Derived, &Derived::Name> dispatcher2;

int main() {
  /* int i1 = dispatcher1.value(&a); */
  int i2 = dispatcher2.value(&a);
  return /* i1 != 1 || */ i2 != 2;
}

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.