From 8a2e0013a04dc28e249660b4c49992b14b5dcc09 Mon Sep 17 00:00:00 2001 From: Marek Polacek <polacek@redhat.com> Date: Fri, 2 Aug 2019 17:51:53 +0000 Subject: [PATCH] =?UTF-8?q?re=20PR=20c++/53009=20(pointer=20to=20static=20?= =?UTF-8?q?member=20function=20of=20template=20class=20is=20=E2=80=9Cinval?= =?UTF-8?q?id=E2=80=9D=20as=20a=20template=20argument=20of=20another=20tem?= =?UTF-8?q?plate=20class)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR c++/53009 * g++.dg/cpp0x/nontype3.C: New test. From-SVN: r274027 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/nontype3.C | 32 +++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/nontype3.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3ba2518d8f28..d57410cb92b6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-08-02 Marek Polacek <polacek@redhat.com> + + PR c++/53009 + * g++.dg/cpp0x/nontype3.C: New test. + 2019-08-02 Marek Polacek <polacek@redhat.com> PR c++/77575 diff --git a/gcc/testsuite/g++.dg/cpp0x/nontype3.C b/gcc/testsuite/g++.dg/cpp0x/nontype3.C new file mode 100644 index 000000000000..02b5f60c3fc8 --- /dev/null +++ b/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(); +} -- GitLab