2014-11-20 Jason Merrill <jason@redhat.com>
+ PR c++/63658
+ * pt.c (convert_nontype_argument): Call convert_from_reference.
+ (check_instantiated_arg): Don't be confused by reference refs.
+ (unify): Look through reference refs on the arg, too.
+ * mangle.c (write_template_arg): Look through reference refs.
+
* error.c (dump_expr): Avoid printing (*&i) for references.
2014-11-20 Ville Voutilainen <ville.voutilainen@gmail.com>
}
}
+ if (REFERENCE_REF_P (node))
+ node = TREE_OPERAND (node, 0);
if (TREE_CODE (node) == NOP_EXPR
&& TREE_CODE (TREE_TYPE (node)) == REFERENCE_TYPE)
{
right type? */
gcc_assert (same_type_ignoring_top_level_qualifiers_p
(type, TREE_TYPE (expr)));
- return expr;
+ return convert_from_reference (expr);
}
/* Subroutine of coerce_template_template_parms, which returns 1 if
constant. */
else if (TREE_TYPE (t)
&& INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (t))
+ && !REFERENCE_REF_P (t)
&& !TREE_CONSTANT (t))
{
if (complain & tf_error)
case INDIRECT_REF:
if (REFERENCE_REF_P (parm))
- return unify (tparms, targs, TREE_OPERAND (parm, 0), arg,
- strict, explain_p);
+ {
+ if (REFERENCE_REF_P (arg))
+ arg = TREE_OPERAND (arg, 0);
+ return unify (tparms, targs, TREE_OPERAND (parm, 0), arg,
+ strict, explain_p);
+ }
/* FALLTHRU */
default:
--- /dev/null
+// PR c++/63658
+
+struct Descriptor {};
+
+template <Descriptor & D>
+struct foo
+{
+ void size ();
+};
+
+Descriptor g_descriptor = {};
+
+template<> void foo<g_descriptor>::size()
+{
+}