2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.mike / p5840.C
blob1cd033005e0c34090a473a5b3b733be32d6b2091
1 // { dg-do run  }
2 // prms-id: 5840
4 class Signal {
5 public:
6   int Name(void) { return 1; }
7 };
9 class Derived : public Signal {
10 public:
11   int Name(void) { return 2; }
14 template <class Foo , int (Foo::*Id)(void)>
15 class Bar
17 public:
18   int value (Foo* a) { return (a->*Id)(); }
21 /* The following line is illegal under the new rules for non-type
22    template arguments in the standard, so it is commented out.  */
23 /* template class Bar <Derived, &Signal::Name>; */
24 template class Bar <Signal, &Signal::Name>;
25 template class Bar <Derived, &Derived::Name>;
27 Derived a;
29 /* Bar<Derived, &Signal::Name> dispatcher1; */
30 Bar<Derived, &Derived::Name> dispatcher2;
32 int main() {
33   /* int i1 = dispatcher1.value(&a); */
34   int i2 = dispatcher2.value(&a);
35   return /* i1 != 1 || */ i2 != 2;