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
|
// { dg-do compile }
// Origin: <togawa at acm dot arg>
// c++/2094: unsupported 'ptrmem_cst' in type unification
struct R
{
int i;
};
struct S
{
int i;
int j;
};
struct S2 : S
{};
template<int S::*p, typename>
struct X
{
X ();
template<typename U> X(const X<p,U> &);
};
X<&S::i,S> x = X<&S::i,S>();
X<&S::i,S> x2 = X<&S2::i,S>();
X<&S::i,S> y = X<&S::j,S>(); // { dg-error "" }
X<&S::i,S> z = X<&R::i,S>(); // { dg-error "" }
template <class T>
struct Foo
{
void foo(void)
{
X<&T::i,T> x = X<&T::i,T>();
X<&S::i,S> x2 = X<&S2::i,S>();
X<&S::i,S> y = X<&S::j,S>(); // { dg-error "" }
X<&S::i,S> z = X<&R::i,S>(); // { dg-error "" }
}
};
template struct Foo<S>; // { dg-error "instantiated from" }
|