blob: 4dd53508dbfa85aaf18cf773c496ebb83975581f (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// PR c++/49663
struct Nosm
{
int m_R;
};
namespace dx {
struct onc
{
typedef void(*Cb)();
onc(Cb cb);
};
struct grac
{
template<class Derived> static void once();
};
template<class Derived>
struct tonc : onc
{
tonc() : onc(&grac::once<Derived>) {}
static Derived& get();
};
template<class Derived> void grac::once()
{
tonc<Derived>::get().h();
}
}
namespace
{
template<typename T, int = sizeof(&T::m_R)>
struct has_R { };
template<typename T>
inline void
setR(T* m, has_R<T>* = 0)
{ }
inline void setR(...) { }
}
template<typename M>
struct Qmi
: dx::tonc<Qmi<M> >
{
void h()
{
setR(&msg);
}
M msg;
};
Qmi<Nosm> x;
|