constexpr.c (cxx_eval_store_expression): Remove hyphen from the spelling of "constant-expression" in diagnostic messages...

gcc/cp/ChangeLog:

	* constexpr.c (cxx_eval_store_expression): Remove hyphen from
	the spelling of "constant-expression" in diagnostic messages
	for consistency.
	(cxx_eval_constant_expression): Same.
	(cxx_eval_outermost_constant_expr): Same.
	(potential_constant_expression_1): Same.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/constexpr-cast.C: Avoid assuming (void*)1 is spelled
	1ul in diagnostics.  Remove hyphen from "constant-expression."
	* g++.dg/cpp0x/constexpr-50060.C: Adjust.
	* g++.dg/cpp0x/static_assert3.C: Same.
	* g++.dg/cpp1y/constexpr-throw.C: Same.
	* g++.dg/template/nontype3.C: Same.
	* g++.dg/warn/overflow-warn-1.C: Same.
	* g++.dg/warn/overflow-warn-3.C: Same.
	* g++.dg/warn/overflow-warn-4.C: Same.

From-SVN: r239176
This commit is contained in:
Martin Sebor 2016-08-05 18:27:46 +00:00 committed by Martin Sebor
parent 88fa5555a3
commit 64d6d39969
11 changed files with 46 additions and 25 deletions

View File

@ -1,3 +1,12 @@
2016-08-05 Martin Sebor <msebor@redhat.com>
* constexpr.c (cxx_eval_store_expression): Remove hyphen from
the spelling of "constant-expression" in diagnostic messages
for consistency.
(cxx_eval_constant_expression): Same.
(cxx_eval_outermost_constant_expr): Same.
(potential_constant_expression_1): Same.
2016-08-05 Nathan Sidwell <nathan@acm.org>
PR c++/68724

View File

@ -3171,7 +3171,7 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t,
/* A constant-expression cannot modify objects from outside the
constant-expression. */
if (!ctx->quiet)
error ("modification of %qE is not a constant-expression", object);
error ("modification of %qE is not a constant expression", object);
*non_constant_p = true;
return t;
}
@ -4098,7 +4098,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
{
if (!ctx->quiet)
error_at (EXPR_LOC_OR_LOC (t, input_location),
"a reinterpret_cast is not a constant-expression");
"a reinterpret_cast is not a constant expression");
*non_constant_p = true;
return t;
}
@ -4140,7 +4140,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
if (!ctx->quiet)
error_at (EXPR_LOC_OR_LOC (t, input_location),
"%<reinterpret_cast<%T>(%E)%> is not "
"a constant-expression",
"a constant expression",
type, op);
*non_constant_p = true;
return t;
@ -4202,7 +4202,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
case OFFSET_REF:
if (!ctx->quiet)
error_at (EXPR_LOC_OR_LOC (t, input_location),
"expression %qE is not a constant-expression", t);
"expression %qE is not a constant expression", t);
*non_constant_p = true;
break;
@ -4283,7 +4283,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
so for now just fail. */
if (!ctx->quiet)
error_at (EXPR_LOCATION (t),
"statement is not a constant-expression");
"statement is not a constant expression");
}
else
internal_error ("unexpected expression %qE of kind %s", t,
@ -4370,7 +4370,7 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant,
{
if (!allow_non_constant)
error ("conversion from pointer type %qT "
"to arithmetic type %qT in a constant-expression",
"to arithmetic type %qT in a constant expression",
TREE_TYPE (TREE_OPERAND (r, 0)), TREE_TYPE (r));
non_constant_p = true;
}
@ -5068,7 +5068,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
case AT_ENCODE_EXPR:
fail:
if (flags & tf_error)
error ("expression %qE is not a constant-expression", t);
error ("expression %qE is not a constant expression", t);
return false;
case TYPEID_EXPR:
@ -5229,7 +5229,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
if (integer_zerop (denom))
{
if (flags & tf_error)
error ("division by zero is not a constant-expression");
error ("division by zero is not a constant expression");
return false;
}
else
@ -5334,7 +5334,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
{
if (flags & tf_error)
error_at (location_of (t),
"%<delete[]%> is not a constant-expression");
"%<delete[]%> is not a constant expression");
return false;
}
/* Fall through. */
@ -5357,7 +5357,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
want_rval, strict, tf_none))
return true;
if (flags & tf_error)
error ("expression %qE is not a constant-expression", t);
error ("expression %qE is not a constant expression", t);
return false;
case VEC_INIT_EXPR:
@ -5385,7 +5385,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
if (breaks (target) || continues (target))
return true;
if (flags & tf_error)
error ("%<goto%> is not a constant-expression");
error ("%<goto%> is not a constant expression");
return false;
}

View File

@ -1,3 +1,15 @@
2016-08-05 Martin Sebor <msebor@redhat.com>
* g++.dg/cpp0x/constexpr-cast.C: Avoid assuming (void*)1 is spelled
1ul in diagnostics. Remove hyphen from "constant-expression."
* g++.dg/cpp0x/constexpr-50060.C: Adjust.
* g++.dg/cpp0x/static_assert3.C: Same.
* g++.dg/cpp1y/constexpr-throw.C: Same.
* g++.dg/template/nontype3.C: Same.
* g++.dg/warn/overflow-warn-1.C: Same.
* g++.dg/warn/overflow-warn-3.C: Same.
* g++.dg/warn/overflow-warn-4.C: Same.
2016-08-05 David Malcolm <dmalcolm@redhat.com>
* gcc.dg/plugin/diagnostic-test-string-literals-1.c: New file.

View File

@ -12,7 +12,7 @@ struct S
struct T
{
constexpr T (double a) : y {}, x ((y = 1, 0.8125)) {} // { dg-error "is not a constant-expression" "T" { target { ! c++14 } } }
constexpr T (double a) : y {}, x ((y = 1, 0.8125)) {} // { dg-error "is not a constant expression" "T" { target { ! c++14 } } }
double x;
int y;
};

View File

@ -8,7 +8,7 @@ int i;
constexpr void *q = reinterpret_cast<void*>(&i); // { dg-error "" "bug c++/49171" { xfail *-*-*-* } }
constexpr void *r0 = reinterpret_cast<void*>(1); // { dg-error "not a constant expression" }
constexpr void *r1 = reinterpret_cast<void*>(sizeof 'x'); // { dg-error ".reinterpret_cast<void\\*>\\(1ul\\). is not a constant-expression" }
constexpr void *r1 = reinterpret_cast<void*>(sizeof 'x'); // { dg-error ".reinterpret_cast<void\\*>\\(1\[ul\]\*\\). is not a constant expression" }
template <class T>
constexpr bool f ()

View File

@ -1,4 +1,4 @@
// { dg-do compile { target c++11 } }
static_assert(7 / 0, "X"); // { dg-error "non-constant condition" "non-constant" }
// { dg-warning "division by zero" "zero" { target *-*-* } 2 }
// { dg-error "division by zero is not a constant-expression" "not a constant" { target *-*-* } 2 }
// { dg-error "division by zero is not a constant expression" "not a constant" { target *-*-* } 2 }

View File

@ -8,25 +8,25 @@ constexpr void f1() {
constexpr void f2() {
if (true)
throw;
} // { dg-error "not a constant-expression" }
} // { dg-error "not a constant expression" }
constexpr void f3() {
if (false)
;
else
throw;
}// { dg-error "not a constant-expression" }
}// { dg-error "not a constant expression" }
constexpr void f4() {
throw;
}// { dg-error "not a constant-expression" }
}// { dg-error "not a constant expression" }
constexpr int fun(int n) {
switch (n) {
case 0:
return 1;
default:
throw; // { dg-error "not a constant-expression" }
throw; // { dg-error "not a constant expression" }
}
}

View File

@ -31,8 +31,8 @@ template <int PI[1]>
void dep10(foo< PI[0] > *); // { dg-error "" "integral or enumeration" }
template <int I>
void dep11(foo< *&I > *); // { dg-error "" "constant-expression" }
void dep11(foo< *&I > *); // { dg-error "" "constant expression" }
template <int I>
void dep12(foo< (&I)[4] > *); // { dg-error "" "constant-expression" }
void dep12(foo< (&I)[4] > *); // { dg-error "" "constant expression" }

View File

@ -130,7 +130,7 @@ h2i (int x)
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 32 } */
/* { dg-warning "invalid conversion from" "convert" { target *-*-* } 56 } */
/* { dg-warning "invalid conversion from" "convert" { target c++11 } 58 } */
/* { dg-error "division by zero is not a constant expression" "division" { target c++11 } 65 } */
/* { dg-error "is not a constant expression" "const" { target *-*-* } 65 } */
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 65 } */
/* { dg-error "width not an integer constant" "bit.field" { target c++ } 32 } */
/* { dg-error "is not a constant expression" "division" { target c++ } 32 } */

View File

@ -65,7 +65,7 @@ g (int i)
switch (i)
{
case 0 * (1/0): /* { dg-warning "division by zero" } */
; /* { dg-error "is not a constant expression" "const" { target *-*-* } 67 } */
; /* { dg-error "division by zero is not a constant expression" "division" { target c++11 } 67 } */
case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */
/* { dg-warning "overflow in constant expression" "constant" { target *-*-* } 69 } */
;
@ -131,6 +131,6 @@ h2i (int x)
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 19 } */
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 32 } */
/* { dg-warning "invalid conversion from" "convert" { target c++11 } 60 } */
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 67 } */
/* { dg-error "not a constant expression" "constant" { target *-*-*-* } 67 } */
/* { dg-error "width not an integer constant" "bit.field" { target c++ } 32 } */
/* { dg-error "is not a constant expression" "division" { target c++ } 32 } */

View File

@ -68,7 +68,7 @@ g (int i)
switch (i)
{
case 0 * (1/0): /* { dg-warning "division by zero" } */
; /* { dg-error "is not a constant expression" "const" { target *-*-* } 70 } */
; /* { dg-error "division by zero is not a constant expression" "division" { target c++11 } 70 } */
case 1 + 0 * (INT_MAX + 1): /* { dg-warning "integer overflow in expression" } */
/* { dg-error "overflow in constant expression" "constant" { target *-*-* } 72 } */
;
@ -134,6 +134,6 @@ h2i (int x)
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 19 } */
/* { dg-error "invalid conversion from" "convert" { target c++11 } 63 } */
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 34 } */
/* { dg-error "division by zero is not a constant.expression" "division" { target c++11 } 70 } */
/* { dg-error "is not a constant expression" "const" { target *-*-*-* } 70 } */
/* { dg-error "width not an integer constant" "bit.field" { target c++ } 34 } */
/* { dg-error "is not a constant expression" "division" { target c++ } 34 } */