Commit f71c1a18 by Jason Merrill Committed by Jason Merrill

PR c++/84720 - ICE with rvalue ref non-type argument.

	* pt.c (convert_nontype_argument): Handle rvalue references.

From-SVN: r258501
parent a6515784
2018-03-13 Jason Merrill <jason@redhat.com> 2018-03-13 Jason Merrill <jason@redhat.com>
PR c++/84720 - ICE with rvalue ref non-type argument.
* pt.c (convert_nontype_argument): Handle rvalue references.
PR c++/84839 - ICE with decltype of parameter pack. PR c++/84839 - ICE with decltype of parameter pack.
* pt.c (tsubst_pack_expansion): Set cp_unevaluated_operand while * pt.c (tsubst_pack_expansion): Set cp_unevaluated_operand while
instantiating dummy parms. instantiating dummy parms.
......
...@@ -6932,11 +6932,18 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain) ...@@ -6932,11 +6932,18 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
return NULL_TREE; return NULL_TREE;
} }
if (!lvalue_p (expr)) if (!glvalue_p (expr)
|| TYPE_REF_IS_RVALUE (type) != xvalue_p (expr))
{ {
if (complain & tf_error) if (complain & tf_error)
error ("%qE is not a valid template argument for type %qT " {
"because it is not an lvalue", expr, type); if (TYPE_REF_IS_RVALUE (type))
error ("%qE is not a valid template argument for type %qT "
"because it is not an xvalue", expr, type);
else
error ("%qE is not a valid template argument for type %qT "
"because it is not an lvalue", expr, type);
}
return NULL_TREE; return NULL_TREE;
} }
......
// PR c++/84720
// { dg-do compile { target c++11 } }
template<int &&>
struct a {
template<typename...>
static void b() {
b();
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment