URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Subversion Repositories openrisc_2011-10-31
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.jason/] [pmem2.C] - Rev 154
Compare with Previous | Blame | View Log
// { dg-do run }
template <class Called>
class aCallback
{
public:
aCallback(Called& obj, int (Called::*met)());
int callback();
protected:
private:
Called& object;
int (Called::*method)();
};
template <class Called>
aCallback<Called>::aCallback(Called& obj,
int (Called::*met)()) :
object(obj),
method(met)
{}
template <class Called>
int aCallback<Called>::callback()
{
return (object.*method)();
}
struct myStruct
{
int action() {return 0;};
};
int main()
{
myStruct toto;
aCallback<myStruct> cb(toto, &myStruct::action);
return cb.callback();
}