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. From-SVN: r258605
This commit is contained in:
parent
80fdaad1c7
commit
83484be8b8
@ -1,5 +1,9 @@
|
|||||||
2018-03-16 Jason Merrill <jason@redhat.com>
|
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.
|
PR c++/80227 - SFINAE and negative array size.
|
||||||
* decl.c (compute_array_index_type): Use
|
* decl.c (compute_array_index_type): Use
|
||||||
build_converted_constant_expr and valid_constant_size_p.
|
build_converted_constant_expr and valid_constant_size_p.
|
||||||
|
18
gcc/cp/pt.c
18
gcc/cp/pt.c
@ -6933,18 +6933,11 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
|
|||||||
return NULL_TREE;
|
return NULL_TREE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!glvalue_p (expr)
|
if (!lvalue_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 "
|
||||||
if (TYPE_REF_IS_RVALUE (type))
|
"because it is not an lvalue", expr, 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23992,7 +23985,10 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain)
|
|||||||
{
|
{
|
||||||
if (INTEGRAL_OR_ENUMERATION_TYPE_P (type))
|
if (INTEGRAL_OR_ENUMERATION_TYPE_P (type))
|
||||||
return false;
|
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;
|
return false;
|
||||||
else if (TYPE_PTRMEM_P (type))
|
else if (TYPE_PTRMEM_P (type))
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// PR c++/84720
|
// PR c++/84720
|
||||||
// { dg-do compile { target c++11 } }
|
// { dg-do compile { target c++11 } }
|
||||||
|
|
||||||
template<int &&>
|
template<int &&> // { dg-error "not a valid type" }
|
||||||
struct a {
|
struct a {
|
||||||
template<typename...>
|
template<typename...>
|
||||||
static void b() {
|
static void b() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user