Commit cea83a3a by Jason Merrill Committed by Jason Merrill

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
parent 52d251b5
2014-08-22 Jason Merrill <jason@redhat.com> 2014-08-22 Jason Merrill <jason@redhat.com>
PR c++/62129 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. * class.c (outermost_open_class): New.
* cp-tree.h: Declare it. * cp-tree.h: Declare it.
* decl.c (maybe_register_incomplete_var): Use it. * decl.c (maybe_register_incomplete_var): Use it.
......
...@@ -7141,7 +7141,9 @@ outermost_open_class (void) ...@@ -7141,7 +7141,9 @@ outermost_open_class (void)
if (!current_class_type) if (!current_class_type)
return NULL_TREE; return NULL_TREE;
tree r = 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) if (current_class_stack[i].hidden)
break; break;
......
...@@ -14367,9 +14367,8 @@ complete_vars (tree type) ...@@ -14367,9 +14367,8 @@ complete_vars (tree type)
tree var = iv->decl; tree var = iv->decl;
tree type = TREE_TYPE (var); tree type = TREE_TYPE (var);
if (decl_constant_var_p (var)) if (TYPE_MAIN_VARIANT (strip_array_types (type))
DECL_INITIAL (var) = cplus_expand_constant (DECL_INITIAL (var)); == iv->incomplete_type)
else
{ {
/* Complete the type of the variable. The VAR_DECL itself /* Complete the type of the variable. The VAR_DECL itself
will be laid out in expand_expr. */ will be laid out in expand_expr. */
...@@ -14377,6 +14376,10 @@ complete_vars (tree type) ...@@ -14377,6 +14376,10 @@ complete_vars (tree type)
cp_apply_type_quals_to_decl (cp_type_quals (type), var); 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. */ /* Remove this entry from the list. */
incomplete_vars->unordered_remove (ix); incomplete_vars->unordered_remove (ix);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment