aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/init.c
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2019-10-02 23:23:51 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2019-10-02 23:23:51 +0000
commitf5fc32e4a38cee21d1935fd04ad19726f76c06a9 (patch)
tree095ec074070c367b73e2026a1792245507ffbfa1 /gcc/cp/init.c
parent775eaa4d83458393a34aa6197ff823b63d6078fd (diff)
downloadgcc-f5fc32e4a38cee21d1935fd04ad19726f76c06a9.zip
gcc-f5fc32e4a38cee21d1935fd04ad19726f76c06a9.tar.gz
gcc-f5fc32e4a38cee21d1935fd04ad19726f76c06a9.tar.bz2
init.c (build_new): Use cp_expr_loc_or_input_loc in two places.
/cp 2019-10-03 Paolo Carlini <paolo.carlini@oracle.com> * init.c (build_new): Use cp_expr_loc_or_input_loc in two places. * name-lookup.c (do_pushdecl): Use DECL_SOURCE_LOCATION. (push_class_level_binding_1): Likewise. (set_decl_namespace): Likewise. /testsuite 2019-10-03 Paolo Carlini <paolo.carlini@oracle.com> * g++.dg/diagnostic/integral-array-size-1.C: New. * g++.dg/cpp0x/alias-decl-1.C: Test location(s) too. * g++.dg/init/new43.C: Likewise. * g++.dg/lookup/friend12.C: Likewise. * g++.dg/lookup/pr79766.C: Likewise. * g++.dg/lookup/pr84375.C: Likewise. * g++.dg/other/new-size-type.C: Likewise. From-SVN: r276496
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r--gcc/cp/init.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 76fa030..857f360 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -3754,7 +3754,8 @@ build_new (vec<tree, va_gc> **placement, tree type, tree nelts,
if (!build_expr_type_conversion (WANT_INT | WANT_ENUM, nelts, false))
{
if (complain & tf_error)
- permerror (input_location, "size in array new must have integral type");
+ permerror (cp_expr_loc_or_input_loc (nelts),
+ "size in array new must have integral type");
else
return error_mark_node;
}
@@ -3769,7 +3770,8 @@ build_new (vec<tree, va_gc> **placement, tree type, tree nelts,
less than zero. ... If the expression is a constant expression,
the program is ill-fomed. */
if (TREE_CODE (cst_nelts) == INTEGER_CST
- && !valid_array_size_p (input_location, cst_nelts, NULL_TREE,
+ && !valid_array_size_p (cp_expr_loc_or_input_loc (nelts),
+ cst_nelts, NULL_TREE,
complain & tf_error))
return error_mark_node;