diff options
author | Marek Polacek <polacek@redhat.com> | 2019-08-02 17:51:53 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2019-08-02 17:51:53 +0000 |
commit | 8a2e0013a04dc28e249660b4c49992b14b5dcc09 (patch) | |
tree | 289997bc6ceff1e5829e4047ddf7831a58432acf | |
parent | 8707c01da9b4a2160fbe04d282e2526da38d3e48 (diff) | |
download | gcc-8a2e0013a04dc28e249660b4c49992b14b5dcc09.zip gcc-8a2e0013a04dc28e249660b4c49992b14b5dcc09.tar.gz gcc-8a2e0013a04dc28e249660b4c49992b14b5dcc09.tar.bz2 |
re PR c++/53009 (pointer to static member function of template class is “invalid” as a template argument of another template class)
PR c++/53009
* g++.dg/cpp0x/nontype3.C: New test.
From-SVN: r274027
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/nontype3.C | 32 |
2 files changed, 37 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3ba2518..d57410c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 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 * g++.dg/cpp0x/nontype2.C: New test. diff --git a/gcc/testsuite/g++.dg/cpp0x/nontype3.C b/gcc/testsuite/g++.dg/cpp0x/nontype3.C new file mode 100644 index 0000000..02b5f60 --- /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(); +} |