diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2019-09-10 08:12:28 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2019-09-10 08:12:28 +0000 |
commit | b08bcba5dc1775618e67f6486240188260084122 (patch) | |
tree | 63cf4ce79d85ce717807eee9a1fa0d04b1e46242 /gcc/cp/decl.c | |
parent | a360a359b784acdb53e20cbb85576b4b3662703a (diff) | |
download | gcc-b08bcba5dc1775618e67f6486240188260084122.zip gcc-b08bcba5dc1775618e67f6486240188260084122.tar.gz gcc-b08bcba5dc1775618e67f6486240188260084122.tar.bz2 |
decl.c (has_designator_problem): Use cp_expr_loc_or_input_loc in error_at.
/cp
2019-09-10 Paolo Carlini <paolo.carlini@oracle.com>
* decl.c (has_designator_problem): Use cp_expr_loc_or_input_loc
in error_at.
(build_enumerator): Likewise.
(cp_finish_decl): Use DECL_SOURCE_LOCATION.
(grokdeclarator): Use id_loc in two error_at; change errror
message about constinit together constexpr to use two ranges.
/testsuite
2019-09-10 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/cpp0x/enum29.C: Test location(s) too.
* g++.dg/cpp0x/lambda/lambda-ice10.C: Likewise.
* g++.dg/cpp2a/constinit3.C: Likewise.
* g++.dg/ext/desig4.C: Likewise.
* g++.dg/ext/label10.C: Likewise.
* g++.old-deja/g++.other/dtor3.C: Likewise.
From-SVN: r275585
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index dfcd7b1..8bb398b 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6114,8 +6114,9 @@ has_designator_problem (reshape_iter *d, tsubst_flags_t complain) if (d->cur->index) { if (complain & tf_error) - error ("C99 designator %qE outside aggregate initializer", - d->cur->index); + error_at (cp_expr_loc_or_input_loc (d->cur->index), + "C99 designator %qE outside aggregate initializer", + d->cur->index); else return true; } @@ -7288,8 +7289,9 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, if ((flags & LOOKUP_CONSTINIT) && !(dk == dk_thread || dk == dk_static)) { - error ("%<constinit%> can only be applied to a variable with static " - "or thread storage duration"); + error_at (DECL_SOURCE_LOCATION (decl), + "%<constinit%> can only be applied to a variable with " + "static or thread storage duration"); return; } @@ -10628,8 +10630,9 @@ grokdeclarator (const cp_declarator *declarator, && !uniquely_derived_from_p (ctype, current_class_type)) { - error ("invalid use of qualified-name %<%T::%D%>", - qualifying_scope, decl); + error_at (id_declarator->id_loc, + "invalid use of qualified-name %<%T::%D%>", + qualifying_scope, decl); return error_mark_node; } } @@ -10816,8 +10819,9 @@ grokdeclarator (const cp_declarator *declarator, keywords shall appear in a decl-specifier-seq." */ if (constinit_p && constexpr_p) { - error_at (min_location (declspecs->locations[ds_constinit], - declspecs->locations[ds_constexpr]), + gcc_rich_location richloc (declspecs->locations[ds_constinit]); + richloc.add_range (declspecs->locations[ds_constexpr]); + error_at (&richloc, "can use at most one of the %<constinit%> and %<constexpr%> " "specifiers"); return error_mark_node; @@ -11831,7 +11835,8 @@ grokdeclarator (const cp_declarator *declarator, && inner_declarator->u.id.sfk == sfk_destructor && arg_types != void_list_node) { - error ("destructors may not have parameters"); + error_at (declarator->id_loc, + "destructors may not have parameters"); arg_types = void_list_node; parms = NULL_TREE; } @@ -15171,8 +15176,9 @@ build_enumerator (tree name, tree value, tree enumtype, tree attributes, if (! INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (TREE_TYPE (value))) { - error ("enumerator value for %qD must have integral or " - "unscoped enumeration type", name); + error_at (cp_expr_loc_or_input_loc (value), + "enumerator value for %qD must have integral or " + "unscoped enumeration type", name); value = NULL_TREE; } else |