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
This commit is contained in:
Marek Polacek 2019-08-02 17:51:53 +00:00 committed by Marek Polacek
parent 8707c01da9
commit 8a2e0013a0
2 changed files with 37 additions and 0 deletions

View File

@ -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

View File

@ -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();
}