diff mbox series

C++ PATCH for more checking of DECL_MUTABLE_P

Message ID 20190810185730.GA14737@redhat.com
State New
Headers show
Series C++ PATCH for more checking of DECL_MUTABLE_P | expand

Commit Message

Marek Polacek Aug. 10, 2019, 6:57 p.m. UTC
Some preparatory work before adding constinit.  mutable is only appropriate for
FIELD_DECLs (when they're not static), but we've never made sure that we're not
setting DECL_MUTABLE_P on a different _DECL.  I mean to use DECL_LANG_FLAG_0 in
a VAR_DECL for DECL_DECLARED_CONSTINIT_P.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2019-08-10  Marek Polacek  <polacek@redhat.com>

	* cp-tree.h (DECL_MUTABLE_P): Use FIELD_DECL_CHECK.

Comments

Jason Merrill Aug. 13, 2019, 2:51 p.m. UTC | #1
On 8/10/19 2:57 PM, Marek Polacek wrote:
> Some preparatory work before adding constinit.  mutable is only appropriate for
> FIELD_DECLs (when they're not static), but we've never made sure that we're not
> setting DECL_MUTABLE_P on a different _DECL.  I mean to use DECL_LANG_FLAG_0 in
> a VAR_DECL for DECL_DECLARED_CONSTINIT_P.
> 
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
> 
> 2019-08-10  Marek Polacek  <polacek@redhat.com>
> 
> 	* cp-tree.h (DECL_MUTABLE_P): Use FIELD_DECL_CHECK.

OK.

Jason
diff mbox series

Patch

diff --git gcc/cp/cp-tree.h gcc/cp/cp-tree.h
index 72ee1d61e97..3b823a6ea0b 100644
--- gcc/cp/cp-tree.h
+++ gcc/cp/cp-tree.h
@@ -3065,9 +3066,9 @@  struct GTY(()) lang_decl {
   (DECL_NONSTATIC_MEMBER_FUNCTION_P (NODE)	\
    || TREE_CODE (NODE) == FIELD_DECL)
 
-/* Nonzero for _DECL means that this member object type
+/* Nonzero for a FIELD_DECL means that this member object type
    is mutable.  */
-#define DECL_MUTABLE_P(NODE) (DECL_LANG_FLAG_0 (NODE))
+#define DECL_MUTABLE_P(NODE) (DECL_LANG_FLAG_0 (FIELD_DECL_CHECK (NODE)))
 
 /* Nonzero for _DECL means that this constructor or conversion function is
    non-converting.  */