From 4cd159317cb88496122bd3999a04c56c513bd915 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 20 Feb 2017 01:05:38 -0500 Subject: [PATCH] PR c++/79470 - partial ordering with reference parameters * pt.c (unify) [INDIRECT_REF]: Handle pack expansions. From-SVN: r245589 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/pt.c | 5 +++++ gcc/testsuite/g++.dg/cpp0x/variadic-ref1.C | 10 ++++++++++ 3 files changed, 18 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/variadic-ref1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ee222b43e0d..033831d7fd0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2017-02-19 Jason Merrill + PR c++/79470 - partial ordering with reference parameters + * pt.c (unify) [INDIRECT_REF]: Handle pack expansions. + PR c++/79500 - ICE with non-template deduction guide * pt.c (do_class_deduction): Use STRIP_TEMPLATE rather than DECL_TEMPLATE_RESULT. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 46e64986491..0a9f5d518d3 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -20918,8 +20918,13 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, case INDIRECT_REF: if (REFERENCE_REF_P (parm)) { + bool pexp = PACK_EXPANSION_P (arg); + if (pexp) + arg = PACK_EXPANSION_PATTERN (arg); if (REFERENCE_REF_P (arg)) arg = TREE_OPERAND (arg, 0); + if (pexp) + arg = make_pack_expansion (arg); return unify (tparms, targs, TREE_OPERAND (parm, 0), arg, strict, explain_p); } diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-ref1.C b/gcc/testsuite/g++.dg/cpp0x/variadic-ref1.C new file mode 100644 index 00000000000..441d386ad81 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-ref1.C @@ -0,0 +1,10 @@ +// PR c++/79470 +// { dg-do compile { target c++11 } } + + template < const int&... > struct AA; + + template < > struct AA<> { }; + + template < const int& II, const int&... Is > + struct AA { }; + -- 2.30.2