diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2018-06-12 21:22:10 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2018-06-12 21:22:10 +0000 |
commit | 2d10ccaa001ba9cb367ee8d8d34512454d6bb293 (patch) | |
tree | b823a06d95bc72c285482124c51a4d6fadf9a95f /gcc/cp | |
parent | 4db9ca8624e902b668ef394cf81e68e4ed5faa89 (diff) | |
download | gcc-2d10ccaa001ba9cb367ee8d8d34512454d6bb293.zip gcc-2d10ccaa001ba9cb367ee8d8d34512454d6bb293.tar.gz gcc-2d10ccaa001ba9cb367ee8d8d34512454d6bb293.tar.bz2 |
decl2.c (coerce_new_type, [...]): Add location_t parameter and adjust error_at calls.
/cp
2018-06-12 Paolo Carlini <paolo.carlini@oracle.com>
* decl2.c (coerce_new_type, coerce_delete_type): Add location_t
parameter and adjust error_at calls.
* decl.c (grok_op_properties): Adjust calls.
* cp-tree.h (oerce_new_type, coerce_delete_type): Adjust decls.
/testsuite
2018-06-12 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/init/delete3.C: New.
* g++.dg/init/new49.C: Likewise.
* g++.dg/init/new25.C: Test locations too.
* g++.dg/template/new4.C: Likewise.
* g++.old-deja/g++.jason/operator.C: Likewise.
From-SVN: r261527
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 4 | ||||
-rw-r--r-- | gcc/cp/decl.c | 4 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 20 |
4 files changed, 22 insertions, 13 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 726fd7f..05105ae 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2018-06-12 Paolo Carlini <paolo.carlini@oracle.com> + + * decl2.c (coerce_new_type, coerce_delete_type): Add location_t + parameter and adjust error_at calls. + * decl.c (grok_op_properties): Adjust calls. + * cp-tree.h (oerce_new_type, coerce_delete_type): Adjust decls. + 2018-06-12 Marek Polacek <polacek@redhat.com> Core issue 1331 - const mismatch with defaulted copy constructor diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index a6d0b43..59ad381 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -6346,8 +6346,8 @@ extern bool attributes_naming_typedef_ok (tree); extern void cplus_decl_attributes (tree *, tree, int); extern void finish_anon_union (tree); extern void cxx_post_compilation_parsing_cleanups (void); -extern tree coerce_new_type (tree); -extern tree coerce_delete_type (tree); +extern tree coerce_new_type (tree, location_t); +extern tree coerce_delete_type (tree, location_t); extern void comdat_linkage (tree); extern void determine_visibility (tree); extern void constrain_class_visibility (tree); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index c835340..de1b341 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -13153,11 +13153,11 @@ grok_op_properties (tree decl, bool complain) } if (op_flags & OVL_OP_FLAG_DELETE) - TREE_TYPE (decl) = coerce_delete_type (TREE_TYPE (decl)); + TREE_TYPE (decl) = coerce_delete_type (TREE_TYPE (decl), loc); else { DECL_IS_OPERATOR_NEW (decl) = 1; - TREE_TYPE (decl) = coerce_new_type (TREE_TYPE (decl)); + TREE_TYPE (decl) = coerce_new_type (TREE_TYPE (decl), loc); } return true; diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 2cef9c7..cbe2f22 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1676,7 +1676,7 @@ finish_anon_union (tree anon_union_decl) what compiler will be expecting. */ tree -coerce_new_type (tree type) +coerce_new_type (tree type, location_t loc) { int e = 0; tree args = TYPE_ARG_TYPES (type); @@ -1686,7 +1686,8 @@ coerce_new_type (tree type) if (!same_type_p (TREE_TYPE (type), ptr_type_node)) { e = 1; - error ("%<operator new%> must return type %qT", ptr_type_node); + error_at (loc, "%<operator new%> must return type %qT", + ptr_type_node); } if (args && args != void_list_node) @@ -1697,8 +1698,8 @@ coerce_new_type (tree type) The first parameter shall not have an associated default argument. */ - error ("the first parameter of %<operator new%> cannot " - "have a default argument"); + error_at (loc, "the first parameter of %<operator new%> cannot " + "have a default argument"); /* Throw away the default argument. */ TREE_PURPOSE (args) = NULL_TREE; } @@ -1713,7 +1714,7 @@ coerce_new_type (tree type) e = 2; if (e == 2) - permerror (input_location, "%<operator new%> takes type %<size_t%> (%qT) " + permerror (loc, "%<operator new%> takes type %<size_t%> (%qT) " "as first parameter", size_type_node); switch (e) @@ -1732,7 +1733,7 @@ coerce_new_type (tree type) } tree -coerce_delete_type (tree type) +coerce_delete_type (tree type, location_t loc) { int e = 0; tree args = TYPE_ARG_TYPES (type); @@ -1742,7 +1743,8 @@ coerce_delete_type (tree type) if (!same_type_p (TREE_TYPE (type), void_type_node)) { e = 1; - error ("%<operator delete%> must return type %qT", void_type_node); + error_at (loc, "%<operator delete%> must return type %qT", + void_type_node); } if (!args || args == void_list_node @@ -1751,8 +1753,8 @@ coerce_delete_type (tree type) e = 2; if (args && args != void_list_node) args = TREE_CHAIN (args); - error ("%<operator delete%> takes type %qT as first parameter", - ptr_type_node); + error_at (loc, "%<operator delete%> takes type %qT as first parameter", + ptr_type_node); } switch (e) { |