re PR c++/24780 (ICE set_mem_attributes_minus_bitpos)

PR c++/24780
	* typeck.c (complete_type): Set TYPE_NEEDS_CONSTRUCTING
	and TYPE_HAS_NONTRIVIAL_DESTRUCTOR flags for all variants
	of array type.

	* g++.dg/opt/pr24780.C: New test.

From-SVN: r106833
This commit is contained in:
Jakub Jelinek 2005-11-12 21:44:55 +01:00 committed by Jakub Jelinek
parent f74dcfb701
commit 73bebd55f0
4 changed files with 30 additions and 2 deletions

View File

@ -1,5 +1,10 @@
2005-11-12 Jakub Jelinek <jakub@redhat.com>
PR c++/24780
* typeck.c (complete_type): Set TYPE_NEEDS_CONSTRUCTING
and TYPE_HAS_NONTRIVIAL_DESTRUCTOR flags for all variants
of array type.
PR c++/24761
* pt.c (tsubst_copy_asm_operands): New function.
(tsubst_expr) <case ASM_EXPR>: Use it.

View File

@ -107,12 +107,18 @@ complete_type (tree type)
else if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type))
{
tree t = complete_type (TREE_TYPE (type));
unsigned int needs_constructing, has_nontrivial_dtor;
if (COMPLETE_TYPE_P (t) && !dependent_type_p (type))
layout_type (type);
TYPE_NEEDS_CONSTRUCTING (type)
needs_constructing
= TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (t));
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
has_nontrivial_dtor
= TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TYPE_MAIN_VARIANT (t));
for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
{
TYPE_NEEDS_CONSTRUCTING (t) = needs_constructing;
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) = has_nontrivial_dtor;
}
}
else if (CLASS_TYPE_P (type) && CLASSTYPE_TEMPLATE_INSTANTIATION (type))
instantiate_class_template (TYPE_MAIN_VARIANT (type));

View File

@ -1,5 +1,8 @@
2005-11-12 Jakub Jelinek <jakub@redhat.com>
PR c++/24780
* g++.dg/opt/pr24780.C: New test.
PR c++/24761
* g++.dg/template/asm1.C: New test.

View File

@ -0,0 +1,14 @@
// PR c++/24780
// { dg-do compile }
template<typename S=int>
struct Move {
Move();
static Move<S> const MOVES[2][2];
};
template<typename S>
Move<S> const Move<S>::MOVES[2][2]={};
typedef Move<int> const MoveClass;
void moves(int x, int y) {
&MoveClass::MOVES[x][y];
}