diff options
author | Jason Merrill <jason@redhat.com> | 2014-08-22 14:49:18 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2014-08-22 14:49:18 -0400 |
commit | cea83a3ac8124fd77a00b7090867beb4875aa482 (patch) | |
tree | a70c0ffdcd72f703db433969bb9756cdfd62a588 | |
parent | 52d251b52234cd64fa14da7981f679c3c564d76b (diff) | |
download | gcc-cea83a3ac8124fd77a00b7090867beb4875aa482.zip gcc-cea83a3ac8124fd77a00b7090867beb4875aa482.tar.gz gcc-cea83a3ac8124fd77a00b7090867beb4875aa482.tar.bz2 |
re PR c++/62129 (internal compiler error: in output_constant, at varasm.c:4755)
PR c++/62129
* class.c (outermost_open_class): Fix logic.
* decl.c (complete_vars): Fix logic.
From-SVN: r214353
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/class.c | 4 | ||||
-rw-r--r-- | gcc/cp/decl.c | 9 |
3 files changed, 15 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8102054..649941c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,12 @@ 2014-08-22 Jason Merrill <jason@redhat.com> PR c++/62129 + * class.c (outermost_open_class): Fix logic. + * decl.c (complete_vars): Fix logic. + +2014-08-22 Jason Merrill <jason@redhat.com> + + PR c++/62129 * class.c (outermost_open_class): New. * cp-tree.h: Declare it. * decl.c (maybe_register_incomplete_var): Use it. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index fd22930..5c9a9a7 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -7141,7 +7141,9 @@ outermost_open_class (void) if (!current_class_type) return NULL_TREE; tree r = NULL_TREE; - for (int i = current_class_depth; i > 0; --i) + if (TYPE_BEING_DEFINED (current_class_type)) + r = current_class_type; + for (int i = current_class_depth - 1; i > 0; --i) { if (current_class_stack[i].hidden) break; diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 2e4e7f8..35ede7a 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -14367,9 +14367,8 @@ complete_vars (tree type) tree var = iv->decl; tree type = TREE_TYPE (var); - if (decl_constant_var_p (var)) - DECL_INITIAL (var) = cplus_expand_constant (DECL_INITIAL (var)); - else + if (TYPE_MAIN_VARIANT (strip_array_types (type)) + == iv->incomplete_type) { /* Complete the type of the variable. The VAR_DECL itself will be laid out in expand_expr. */ @@ -14377,6 +14376,10 @@ complete_vars (tree type) cp_apply_type_quals_to_decl (cp_type_quals (type), var); } + if (DECL_INITIAL (var) + && decl_constant_var_p (var)) + DECL_INITIAL (var) = cplus_expand_constant (DECL_INITIAL (var)); + /* Remove this entry from the list. */ incomplete_vars->unordered_remove (ix); } |