diff options
author | Mark Mitchell <mark@codesourcery.com> | 2005-10-13 23:59:57 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2005-10-13 23:59:57 +0000 |
commit | 6c06fbce5c77ffbb0be281d22780a919de4877fe (patch) | |
tree | a4da9de28c6912e3768cb698ed0a81ac34281fd1 /gcc/cp/cp-tree.h | |
parent | 02f3e085c7ba33279329aae728aaf42dc922add6 (diff) | |
download | gcc-6c06fbce5c77ffbb0be281d22780a919de4877fe.zip gcc-6c06fbce5c77ffbb0be281d22780a919de4877fe.tar.gz gcc-6c06fbce5c77ffbb0be281d22780a919de4877fe.tar.bz2 |
re PR c++/20721 (crossing of a initialization left undetected on goto)
PR c++/20721
* cp-tree.h (DECL_NONTRIVIALLY_INITIALIZED_P): New macro.
* decl.c (duplicate_decls): Merge it into new declarations.
(decl_jump_unsafe): Use it, rather than DECL_INITIAL.
(cp_finish_decl): Set it, when appropriate.
PR c++/20721
* g++.dg/init/goto2.C: New test.
From-SVN: r105380
Diffstat (limited to 'gcc/cp/cp-tree.h')
-rw-r--r-- | gcc/cp/cp-tree.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index ceaa425..42eed5f 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -69,6 +69,7 @@ struct diagnostic_context; FN_TRY_BLOCK_P (in TRY_BLOCK) IDENTIFIER_CTOR_OR_DTOR_P (in IDENTIFIER_NODE) BIND_EXPR_BODY_BLOCK (in BIND_EXPR) + DECL_NON_TRIVIALLY_INITIALIZED_P (in VAR_DECL) 4: TREE_HAS_CONSTRUCTOR (in INDIRECT_REF, SAVE_EXPR, CONSTRUCTOR, or FIELD_DECL). IDENTIFIER_TYPENAME_P (in IDENTIFIER_NODE) @@ -1784,11 +1785,17 @@ struct lang_decl GTY(()) should be allocated. */ #define DECL_IN_AGGR_P(NODE) (DECL_LANG_FLAG_3 (NODE)) -/* Nonzero for a VAR_DECL means that the variable's initialization has - been processed. */ +/* Nonzero for a VAR_DECL means that the variable's initialization (if + any) has been processed. (In general, DECL_INITIALIZED_P is + !DECL_EXTERN, but static data members may be initialized even if + not defined.) */ #define DECL_INITIALIZED_P(NODE) \ (TREE_LANG_FLAG_1 (VAR_DECL_CHECK (NODE))) +/* Nonzero for a VAR_DECL iff an explicit initializer was provided. */ +#define DECL_NONTRIVIALLY_INITIALIZED_P(NODE) \ + (TREE_LANG_FLAG_3 (VAR_DECL_CHECK (NODE))) + /* Nonzero for a VAR_DECL that was initialized with a constant-expression. */ #define DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P(NODE) \ |