From e79d51963378b10ab90544a7d8eeb6266e9a57f6 Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Thu, 15 Dec 2022 18:50:16 -0500 Subject: c++: variadic using-decl with parm pack in terminal name [PR102104] There's a curious corner case with variadic member using-decls: the terminal name can also contain a parameter pack, and only through naming a conversion function, e.g. using A::operator Ts...; We currently only handle parameter packs appearing in the qualifying scope of a variadic using-decl; this patch adds support for the above case as well, representing such a using-decl via two pack expansions, one for the qualifying scope and one for the terminal name (despite logically there being just one). Then at instantiation time we manually merge them. PR c++/102104 PR c++/108090 gcc/cp/ChangeLog: * error.cc (dump_decl) : Look through a pack expansion in the name as well. * parser.cc (cp_parser_using_declaration): Handle a parameter pack appearing in the terminal name of a variadic using-decl. * pt.cc (tsubst_decl) : Likewise. Combine the handling of variadic and non-variadic using-decls. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/using-variadic1.C: New test. * g++.dg/cpp1z/using-variadic1a.C: New test. * g++.dg/cpp1z/using-variadic1b.C: New test. * g++.dg/cpp1z/using-variadic1c.C: New test. * g++.dg/cpp1z/using-variadic2.C: New test. * g++.dg/cpp1z/using-variadic3.C: New test. --- gcc/cp/error.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gcc/cp/error.cc') diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc index 12b28e8..e7f6033 100644 --- a/gcc/cp/error.cc +++ b/gcc/cp/error.cc @@ -1477,11 +1477,20 @@ dump_decl (cxx_pretty_printer *pp, tree t, int flags) if (!(flags & TFF_UNQUALIFIED_NAME)) { tree scope = USING_DECL_SCOPE (t); + tree name = DECL_NAME (t); if (PACK_EXPANSION_P (scope)) { scope = PACK_EXPANSION_PATTERN (scope); variadic = true; } + if (identifier_p (name) + && IDENTIFIER_CONV_OP_P (name) + && PACK_EXPANSION_P (TREE_TYPE (name))) + { + name = make_conv_op_name (PACK_EXPANSION_PATTERN + (TREE_TYPE (name))); + variadic = true; + } dump_type (pp, scope, flags); pp_cxx_colon_colon (pp); } -- cgit v1.1