2018-03-16 Jason Merrill <jason@redhat.com>
+ PR c++/84720 - ICE with rvalue ref non-type argument.
+ * pt.c (invalid_nontype_parm_type_p): Prohibit rvalue reference.
+ (convert_nontype_argument): Revert earlier change.
+
PR c++/80227 - SFINAE and negative array size.
* decl.c (compute_array_index_type): Use
build_converted_constant_expr and valid_constant_size_p.
return NULL_TREE;
}
- if (!glvalue_p (expr)
- || TYPE_REF_IS_RVALUE (type) != xvalue_p (expr))
+ if (!lvalue_p (expr))
{
if (complain & tf_error)
- {
- 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);
- }
+ error ("%qE is not a valid template argument for type %qT "
+ "because it is not an lvalue", expr, type);
return NULL_TREE;
}
{
if (INTEGRAL_OR_ENUMERATION_TYPE_P (type))
return false;
- else if (POINTER_TYPE_P (type))
+ else if (TYPE_PTR_P (type))
+ return false;
+ else if (TREE_CODE (type) == REFERENCE_TYPE
+ && !TYPE_REF_IS_RVALUE (type))
return false;
else if (TYPE_PTRMEM_P (type))
return false;