view gcc/testsuite/g++.dg/template/ptrmem23.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// 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>;