aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/template/ptrmem23.C
blob: 28c0a63e58921f2eb88a00dde9762a828d4cbba4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// PR c++/56247

struct Base {
    void method() {}
};

typedef void (Base::*MemPtr)();

// Template with a member function pointer "non-type parameter".
template<MemPtr func>
struct Wrapper {};

template<class C>
struct Child : public Base {
    // Templated derived class instantiates the Wrapper with the same parameter
    // in two different virtual methods.
    void foo() { typedef Wrapper<&Base::method> W; }
    void bar() { typedef Wrapper<&Base::method> W; }
};

// Instantiate Child with some type.
template class Child<int>;