From 0d2e69cb3c08f44a15415fb264bf438bb8c9707c Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 22 May 2018 23:52:49 -0400 Subject: [PATCH] PR c++/85866 - error with .* in default template arg. * pt.c (tsubst_copy_and_build): Handle partial instantiation. From-SVN: r260562 --- gcc/cp/ChangeLog | 5 ++++ gcc/cp/pt.c | 4 +++- gcc/testsuite/g++.dg/cpp0x/fntmpdefarg9.C | 29 +++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/fntmpdefarg9.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6aed157616b..ce22731d63c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-05-22 Jason Merrill + + PR c++/85866 - error with .* in default template arg. + * pt.c (tsubst_copy_and_build): Handle partial instantiation. + 2018-05-21 Paolo Carlini * parser.c (cp_parser_parameter_declaration_list): Remove diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 81de633b1ee..0b04770e123 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -18433,7 +18433,9 @@ tsubst_copy_and_build (tree t, /* Unsupported internal function with arguments. */ gcc_unreachable (); } - else if (TREE_CODE (function) == OFFSET_REF) + else if (TREE_CODE (function) == OFFSET_REF + || TREE_CODE (function) == DOTSTAR_EXPR + || TREE_CODE (function) == MEMBER_REF) ret = build_offset_ref_call_from_tree (function, &call_args, complain); else if (TREE_CODE (function) == COMPONENT_REF) diff --git a/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg9.C b/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg9.C new file mode 100644 index 00000000000..833049c6de3 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/fntmpdefarg9.C @@ -0,0 +1,29 @@ +// PR c++/85866 +// { dg-do compile { target c++11 } } + +template +_Up +__declval(int); + +template +_Tp +__declval(long); + +template +auto declval() noexcept -> decltype(__declval<_Tp>(0)); + +template +using void_t = void; + +template().*declval()) () ) + >* = nullptr> +void boom(){} + +struct Foo { + void bar(){} +}; + +int main() { + boom(); +}