aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/pr51547.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/cpp0x/pr51547.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/pr51547.C50
1 files changed, 50 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/pr51547.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/pr51547.C
new file mode 100644
index 0000000..578a799
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/pr51547.C
@@ -0,0 +1,50 @@
+// PR c++/51547
+// { dg-do compile { target c++11 } }
+
+template <class T>
+struct vector
+{
+ T*
+ begin()
+ { return &member; }
+
+ const T*
+ begin() const
+ { return &member; }
+
+ T member;
+};
+
+struct Bar {
+ int x;
+};
+
+struct Foo {
+ const vector<Bar>& bar() const {
+ return bar_;
+ }
+
+ vector<Bar> bar_;
+};
+
+template <class X>
+struct Y {
+ void foo() {
+ Foo a;
+ auto b = a.bar().begin();
+ auto&& c = b->x;
+ }
+};
+
+template <class X>
+void foo() {
+ Foo a;
+ auto b = a.bar().begin();
+ auto&& c = b->x;
+}
+
+int main() {
+ Y<int> p;
+ p.foo();
+ foo<int>();
+}