FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.mike / p5840.C
blob34dd37df6c3a758fe80d23f7e1c848c608bf1e9c
1 // prms-id: 5840
3 class Signal {
4 public:
5   int Name(void) { return 1; }
6 };
8 class Derived : public Signal {
9 public:
10   int Name(void) { return 2; }
13 template <class Foo , int (Foo::*Id)(void)>
14 class Bar
16 public:
17   int value (Foo* a) { return (a->*Id)(); }
20 /* The following line is illegal under the new rules for non-type
21    template arguments in the standard, so it is commented out.  */
22 /* template class Bar <Derived, &Signal::Name>; */
23 template class Bar <Signal, &Signal::Name>;
24 template class Bar <Derived, &Derived::Name>;
26 Derived a;
28 /* Bar<Derived, &Signal::Name> dispatcher1; */
29 Bar<Derived, &Derived::Name> dispatcher2;
31 int main() {
32   /* int i1 = dispatcher1.value(&a); */
33   int i2 = dispatcher2.value(&a);
34   return /* i1 != 1 || */ i2 != 2;