aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/template/ptrmem27.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/template/ptrmem27.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/template/ptrmem27.C22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/template/ptrmem27.C b/gcc-4.9/gcc/testsuite/g++.dg/template/ptrmem27.C
new file mode 100644
index 000000000..8c63f9c29
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/template/ptrmem27.C
@@ -0,0 +1,22 @@
+// PR c++/61500
+
+struct X {
+ int i;
+ int j;
+
+ int foo(int X::* ptr);
+
+ template <int X::* ptr>
+ int bar();
+};
+
+int X::foo(int X::* ptr) {
+ int* p = &(this->*ptr); // OK.
+ return *p;
+}
+
+template <int X::* ptr>
+int X::bar() {
+ int* p = &(this->*ptr); // gcc 4.9.0: OK in C++98 mode, fails in C++11 mode.
+ return *p;
+}