blob: 93d292a9fd6d4843505dc3b7e889d1d02d4203b9 (
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
|
// { dg-do compile { target c++11 } }
struct Iter
{
int& operator* ();
void operator++ ();
};
bool operator!= (Iter &, Iter &) { }
struct Container
{
Iter begin () const;
Iter end () const;
};
struct J
{
virtual J *mutable_child ();
};
struct M
{
M (const Container &);
J ns_;
};
namespace
{
J MakeNamespace (const Container &src)
{
J a;
J *b = 0;
for (const int &c: src)
b = b ? b->mutable_child () : &a;
return a;
}
}
M::M (const Container &ns):ns_ (MakeNamespace (ns))
{
}
|