]> gcc.gnu.org Git - gcc.git/commitdiff
c++: Add fixed test [PR83596]
authorMarek Polacek <polacek@redhat.com>
Fri, 29 Apr 2022 13:52:55 +0000 (09:52 -0400)
committerMarek Polacek <polacek@redhat.com>
Fri, 29 Apr 2022 13:53:27 +0000 (09:53 -0400)
This was fixed by r269078.

PR c++/83596

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/nontype5.C: New test.

gcc/testsuite/g++.dg/cpp1z/nontype5.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/cpp1z/nontype5.C b/gcc/testsuite/g++.dg/cpp1z/nontype5.C
new file mode 100644 (file)
index 0000000..7e6639d
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/83596
+// { dg-do compile { target c++17 } }
+
+struct X { int x; int y; };
+template <int X::* mp> int get(X& x) { return x.*mp; }
+constexpr int X::* getMP() { return &X::y; }
+constexpr int X::* mptr = getMP();
+int test() {
+    X x{1, 2};
+    return get<mptr>(x);
+}
This page took 0.065056 seconds and 5 git commands to generate.