summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/ptrmem21.C
blob: c30fa38fc4210cc4576875e3ec45171987aece5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// PR c++/43868
// { dg-options "-g" }

struct Foo
{
    virtual void do_something() = 0;
};

template <typename T>
struct Foo_impl;

template <typename R, typename O>
struct Foo_impl<R (O::*)() const> : public Foo
{
    struct Helper
    {
        typedef int Some_type;
        operator Some_type () const { return 0; }
        Helper( R (O::*)() const) {}
    };

    void do_something() {  Helper( 0); };
};

void register_foo_internal( Foo*) {};

template <typename TT>
void register_foo( TT) { register_foo_internal( new Foo_impl<TT>()); }

struct Bar
{
};

void setup()
{
    register_foo( (int (Bar::*) () const) 0);
}