aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/trailing8.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.8/gcc/testsuite/g++.dg/cpp0x/trailing8.C')
-rw-r--r--gcc-4.8/gcc/testsuite/g++.dg/cpp0x/trailing8.C25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/trailing8.C b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/trailing8.C
new file mode 100644
index 000000000..304845e66
--- /dev/null
+++ b/gcc-4.8/gcc/testsuite/g++.dg/cpp0x/trailing8.C
@@ -0,0 +1,25 @@
+// PR c++/54359
+// { dg-require-effective-target c++11 }
+
+int& ref(int& x) { return x; }
+const int& ref(const int& x) { return x; }
+
+class A {
+ int x;
+ int f() const;
+ auto test1() const -> decltype(this);
+ auto test2() const -> decltype(ref(x));
+ auto test3() const -> decltype(f());
+};
+
+auto A::test1() const -> decltype(this) {
+ return this;
+}
+
+auto A::test2() const -> decltype(ref(x)) {
+ return ref(x);
+}
+
+auto A::test3() const -> decltype(f()) {
+ return f();
+}