diff options
author | Jakub Jelinek <jakub@redhat.com> | 2005-11-12 21:44:55 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2005-11-12 21:44:55 +0100 |
commit | 73bebd55f00bd2b0c8e210c2fdd224b3987be7cd (patch) | |
tree | 13bc40e9b1ccff2a909a478f29817ca5fd118ca1 /gcc | |
parent | f74dcfb70183a037feaefaa9e6d491249cbafc2f (diff) | |
download | gcc-73bebd55f00bd2b0c8e210c2fdd224b3987be7cd.zip gcc-73bebd55f00bd2b0c8e210c2fdd224b3987be7cd.tar.gz gcc-73bebd55f00bd2b0c8e210c2fdd224b3987be7cd.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/opt/pr24780.C | 14 |
4 files changed, 30 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5736a0d..6edab04 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index b9be6fd..31e2d6f 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5500af1..e9cc432 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/g++.dg/opt/pr24780.C b/gcc/testsuite/g++.dg/opt/pr24780.C new file mode 100644 index 0000000..7baad38 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr24780.C @@ -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]; +} |