PR c++/80840 - ICE with constexpr and reference
* pt.c (convert_nontype_argument): Don't test whether a decl is value-dependent when binding to a reference. From-SVN: r248755
This commit is contained in:
parent
78578b7e04
commit
222a78553a
|
@ -1,5 +1,9 @@
|
|||
2017-05-31 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/80840 - ICE with constexpr and reference
|
||||
* pt.c (convert_nontype_argument): Don't test whether a decl is
|
||||
value-dependent when binding to a reference.
|
||||
|
||||
PR c++/80856 - ICE with local extern in template
|
||||
* semantics.c (finish_call_expr): Replace a local extern overload
|
||||
set in a template with the IDENTIFIER_NODE.
|
||||
|
|
11
gcc/cp/pt.c
11
gcc/cp/pt.c
|
@ -6669,7 +6669,11 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
|
|||
}
|
||||
}
|
||||
|
||||
if (!value_dependent_expression_p (expr))
|
||||
if (TYPE_REF_OBJ_P (TREE_TYPE (expr))
|
||||
&& value_dependent_expression_p (expr))
|
||||
/* OK, dependent reference. We don't want to ask whether a DECL is
|
||||
itself value-dependent, since what we want here is its address. */;
|
||||
else
|
||||
{
|
||||
if (!DECL_P (expr))
|
||||
{
|
||||
|
@ -6691,8 +6695,11 @@ convert_nontype_argument (tree type, tree expr, tsubst_flags_t complain)
|
|||
return NULL_TREE;
|
||||
}
|
||||
|
||||
expr = build_nop (type, build_address (expr));
|
||||
expr = build_address (expr);
|
||||
}
|
||||
|
||||
if (!same_type_p (type, TREE_TYPE (expr)))
|
||||
expr = build_nop (type, expr);
|
||||
}
|
||||
/* [temp.arg.nontype]/5, bullet 4
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
// PR c++/80840
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
template <class T, T X>
|
||||
struct Just;
|
||||
|
||||
template <const double& X>
|
||||
struct Number {
|
||||
static constexpr double value = X;
|
||||
using result = Just<const double&, value>;
|
||||
};
|
||||
|
||||
int main() {}
|
Loading…
Reference in New Issue