Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / g++.dg / template / ptrmem1.C
blobebd6a201a97d0becbade2c61415456fc953ceafc
1 // { dg-do compile }
3 // Copyright (C) 2001 Free Software Foundation, Inc.
4 // Contributed by Nathan Sidwell 31 Dec 2001 <nathan@codesourcery.com>
6 // PR 3716 tsubsting a pointer to member function did not create a
7 // pointer to member function.
9 template <class C, class T, T C::*M>
10 struct Closure
12   T operator() (C & c) const { return (c.*M); }
15 template <class C, class T, T (C::* M)()>
16 struct Closure<C, T (), M>
18   T operator()(C & c) const { return (c.*M)(); }
21 struct A
23   int get();
25   
26 static Closure<A, int (), & A::get> get_closure;
29 void Foo ()
31   A a;
32   get_closure (a);