Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/pr51547.C

raw
1 // PR c++/51547
2 // { dg-do compile { target c++11 } }
3
4 template <class T>
5 struct vector
6 {
7 T*
8 begin()
9 { return &member; }
10
11 const T*
12 begin() const
13 { return &member; }
14
15 T member;
16 };
17
18 struct Bar {
19 int x;
20 };
21
22 struct Foo {
23 const vector<Bar>& bar() const {
24 return bar_;
25 }
26
27 vector<Bar> bar_;
28 };
29
30 template <class X>
31 struct Y {
32 void foo() {
33 Foo a;
34 auto b = a.bar().begin();
35 auto&& c = b->x;
36 }
37 };
38
39 template <class X>
40 void foo() {
41 Foo a;
42 auto b = a.bar().begin();
43 auto&& c = b->x;
44 }
45
46 int main() {
47 Y<int> p;
48 p.foo();
49 foo<int>();
50 }