#include <iostream>
template < typename T, typename U>
class e
{
void Print( ) //call this function!
{
std:: cout << "You haxxor..." << std:: endl ;
}
public :
T g( )
{
return & U:: Print ;
}
} ;
struct Foo {
static const int Print = 0 ;
} ;
int main( ) {
e< void ( e< int * , Foo> :: * ) ( ) , e< int * , Foo> > e1;
void ( e< int * , Foo> :: * ptr) ( ) = e1.g ( ) ;
e< int * , Foo> e2;
( e2.* ptr) ( ) ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdGVtcGxhdGU8dHlwZW5hbWUgVCwgdHlwZW5hbWUgVT4KY2xhc3MgZQp7CiAgICB2b2lkIFByaW50KCkgLy9jYWxsIHRoaXMgZnVuY3Rpb24hCiAgICB7CiAgICAgICAgc3RkOjpjb3V0IDw8ICJZb3UgaGF4eG9yLi4uIiA8PCBzdGQ6OmVuZGw7CiAgICB9CnB1YmxpYzoKICAgIFQgZygpCiAgICB7CiAgICAgICAgcmV0dXJuJlU6OlByaW50OwogICAgfQp9OwoKc3RydWN0IEZvbyB7CiAgICBzdGF0aWMgY29uc3QgaW50IFByaW50ID0gMDsKfTsKCmludCBtYWluKCkgewogICBlPHZvaWQgKGU8aW50KiwgRm9vPjo6KikoKSwgZTxpbnQqLCBGb28+ID4gZTE7CiAgIHZvaWQgKGU8aW50KiwgRm9vPjo6KnB0cikoKSA9IGUxLmcoKTsKICAgZTxpbnQqLCBGb28+IGUyOwogICAoZTIuKnB0cikoKTsKfQ==
compilation info
prog.cpp: In member function ‘T e<T, U>::g() [with T = void (e<int*, Foo>::*)(), U = e<int*, Foo>]’:
prog.cpp:23: instantiated from here
prog.cpp:6: error: ‘void e<T, U>::Print() [with T = int*, U = Foo]’ is private
prog.cpp:13: error: within this context
stdout