summaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 452f761a778..6f2c023aa5f 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -12462,8 +12462,6 @@ build_enumerator (tree name, tree value, tree enumtype, location_t loc)
{
if (TYPE_VALUES (enumtype))
{
- HOST_WIDE_INT hi;
- unsigned HOST_WIDE_INT lo;
tree prev_value;
bool overflowed;
@@ -12479,15 +12477,13 @@ build_enumerator (tree name, tree value, tree enumtype, location_t loc)
value = error_mark_node;
else
{
- overflowed = add_double (TREE_INT_CST_LOW (prev_value),
- TREE_INT_CST_HIGH (prev_value),
- 1, 0, &lo, &hi);
+ double_int di = TREE_INT_CST (prev_value)
+ .add_with_sign (double_int_one,
+ false, &overflowed);
if (!overflowed)
{
- double_int di;
tree type = TREE_TYPE (prev_value);
- bool pos = (TYPE_UNSIGNED (type) || hi >= 0);
- di.low = lo; di.high = hi;
+ bool pos = TYPE_UNSIGNED (type) || !di.is_negative ();
if (!double_int_fits_to_tree_p (type, di))
{
unsigned int itk;