This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH to add test for c++/53009
- From: Marek Polacek <polacek at redhat dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 2 Aug 2019 13:50:59 -0400
- Subject: C++ PATCH to add test for c++/53009
Fixed by r251438 and the test seems useful.
Tested on x86_64-linux, applying to trunk.
2019-08-02 Marek Polacek <polacek@redhat.com>
PR c++/53009
* g++.dg/cpp0x/nontype3.C: New test.
diff --git gcc/testsuite/g++.dg/cpp0x/nontype3.C gcc/testsuite/g++.dg/cpp0x/nontype3.C
new file mode 100644
index 00000000000..02b5f60c3fc
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp0x/nontype3.C
@@ -0,0 +1,32 @@
+// PR c++/53009
+// { dg-do compile { target c++11 } }
+
+template<typename T, T> class function_proxy;
+
+template<typename Return, typename Obj, Return(*func)(Obj)>
+struct function_proxy<Return(*)(Obj), func>
+{
+ static void wrapper(){ }
+};
+
+template<typename CT, CT> class member_helper;
+
+template<typename Class, void(Class::*fun)()>
+struct member_helper<void(Class::*)(), fun>
+{
+ static void as_free(Class& obj){ }
+
+ static void worker(){
+ (void) function_proxy<decltype(&as_free), &as_free>::wrapper;
+ }
+};
+
+struct Test
+{
+ void test(){ }
+};
+
+int main()
+{
+ member_helper<decltype(&Test::test), &Test::test>::worker();
+}