diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2018-12-07 17:48:39 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2018-12-07 17:48:39 +0000 |
commit | fee11e77e59bb08b695ca4fb356322a8214a03c2 (patch) | |
tree | f24d1372131fa2548e34bf3e90ac769722bf308a /gcc/cp | |
parent | 96e14fda0dca4d79479137844b4457305fad2c3f (diff) | |
download | gcc-fee11e77e59bb08b695ca4fb356322a8214a03c2.zip gcc-fee11e77e59bb08b695ca4fb356322a8214a03c2.tar.gz gcc-fee11e77e59bb08b695ca4fb356322a8214a03c2.tar.bz2 |
decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in error messages about bit-fields with function type...
/cp
2018-12-07 Paolo Carlini <paolo.carlini@oracle.com>
* decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in error messages
about bit-fields with function type, warn_if_not_aligned type, and
static bit-fields; avoid DECL_NAME for unnamed declarations.
/testsuite
2018-12-07 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/other/bitfield7.C: New.
* g++.dg/parse/bitfield8.C: Likewise.
* g++.dg/parse/bitfield9.C: Likewise.
* g++.dg/pr53037-4.C: Test the locations too.
From-SVN: r266900
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 13 |
2 files changed, 13 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6481ad4..fc22f20 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-12-07 Paolo Carlini <paolo.carlini@oracle.com> + + * decl2.c (grokbitfield): Use DECL_SOURCE_LOCATION in error messages + about bit-fields with function type, warn_if_not_aligned type, and + static bit-fields; avoid DECL_NAME for unnamed declarations. + 2018-12-07 Jakub Jelinek <jakub@redhat.com> PR c++/86669 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 15b0393..a8bf28a 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1046,15 +1046,15 @@ grokbitfield (const cp_declarator *declarator, check here. */ if (TREE_CODE (value) == FUNCTION_DECL) { - error ("cannot declare bit-field %qD with function type", - DECL_NAME (value)); + error_at (DECL_SOURCE_LOCATION (value), + "cannot declare bit-field %qD with function type", value); return NULL_TREE; } - if (width && TYPE_WARN_IF_NOT_ALIGN (type)) + if (TYPE_WARN_IF_NOT_ALIGN (type)) { - error ("cannot declare bit-field %qD with %<warn_if_not_aligned%> type", - DECL_NAME (value)); + error_at (DECL_SOURCE_LOCATION (value), "cannot declare bit-field " + "%qD with %<warn_if_not_aligned%> type", value); return NULL_TREE; } @@ -1067,7 +1067,8 @@ grokbitfield (const cp_declarator *declarator, if (TREE_STATIC (value)) { - error ("static member %qD cannot be a bit-field", value); + error_at (DECL_SOURCE_LOCATION (value), + "static member %qD cannot be a bit-field", value); return NULL_TREE; } |