diff options
| author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-09-01 07:46:38 +0000 |
|---|---|---|
| committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-09-01 07:46:38 +0000 |
| commit | 900b9bc3204bb6f0cbe8a003a0e1cb290b15a90a (patch) | |
| tree | 5c0d0910aad95f6cf29f373f24156cc73a7b6e69 | |
| parent | a7343a6d6dca86750479a7c966b067f7bf96f649 (diff) | |
| download | ppe42-gcc-900b9bc3204bb6f0cbe8a003a0e1cb290b15a90a.tar.gz ppe42-gcc-900b9bc3204bb6f0cbe8a003a0e1cb290b15a90a.zip | |
* cp-lang.c (cp_expr_size): Allow initialization from a
CONSTRUCTOR.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56720 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/cp/cp-lang.c | 4 | ||||
| -rw-r--r-- | gcc/testsuite/g++.dg/init/aggr1.C | 19 |
3 files changed, 27 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ba4fdbcbf06..5a4ce9762e5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2002-08-31 Jason Merrill <jason@redhat.com> + + * cp-lang.c (cp_expr_size): Allow initialization from a + CONSTRUCTOR. + 2002-08-30 Richard Henderson <rth@redhat.com> PR opt/7515 diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index f2689b5da97..3f771a9ccfd 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -298,7 +298,9 @@ cp_expr_size (exp) of a type with both of these set; all copies of such types must go through a constructor or assignment op. */ if (TYPE_HAS_COMPLEX_INIT_REF (TREE_TYPE (exp)) - && TYPE_HAS_COMPLEX_ASSIGN_REF (TREE_TYPE (exp))) + && TYPE_HAS_COMPLEX_ASSIGN_REF (TREE_TYPE (exp)) + /* But storing a CONSTRUCTOR isn't a copy. */ + && TREE_CODE (exp) != CONSTRUCTOR) abort (); /* This would be wrong for a type with virtual bases, but they are caught by the abort above. */ diff --git a/gcc/testsuite/g++.dg/init/aggr1.C b/gcc/testsuite/g++.dg/init/aggr1.C new file mode 100644 index 00000000000..c63f0b02c65 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/aggr1.C @@ -0,0 +1,19 @@ +// Test that initializing an aggregate with complex copy constructor +// and assignment ops doesn't cause cp_expr_size to abort. + +struct A +{ + A(); + A(const A&); + A& operator=(const A&); +}; + +struct B +{ + A a; +}; + +int main () +{ + B b = { A() }; +} |

