diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2005-02-17 19:25:05 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2005-02-17 19:25:05 +0000 |
commit | ae54ec16cdaf815a4e416e8193dd9e645b73fdab (patch) | |
tree | 8e65cf1212a979de73c372e019c8f791799fda07 /gcc | |
parent | 2a2c6e55e790704eb0e4013276aee8a91cec46c5 (diff) | |
download | gcc-ae54ec16cdaf815a4e416e8193dd9e645b73fdab.zip gcc-ae54ec16cdaf815a4e416e8193dd9e645b73fdab.tar.gz gcc-ae54ec16cdaf815a4e416e8193dd9e645b73fdab.tar.bz2 |
re PR c++/20028 (class and then template class gives an ICE)
gcc/cp/ChangeLog:
PR c++/20028
* class.c (finish_struct): Initialize TYPE_SIZE_UNIT of a
template along with TYPE_SIZE.
gcc/testsuite/ChangeLog:
PR c++/20028
* g++.dg/template/crash34.C: New.
From-SVN: r95182
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/class.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/crash34.C | 12 |
4 files changed, 20 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f1406be..cdbbfa5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2005-02-17 Alexandre Oliva <aoliva@redhat.com> + PR c++/20028 + * class.c (finish_struct): Initialize TYPE_SIZE_UNIT of a + template along with TYPE_SIZE. + PR c++/20022 * semantics.c (perform_deferred_access_checks): Use get_deferred_access_checks to get the top of the stack. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index ae73f52..77e9b80 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5111,6 +5111,7 @@ finish_struct (tree t, tree attributes) finish_struct_methods (t); TYPE_SIZE (t) = bitsize_zero_node; + TYPE_SIZE_UNIT (t) = size_zero_node; /* We need to emit an error message if this type was used as a parameter and it is an abstract type, even if it is a template. We construct diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4d58a10..d03c81f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2005-02-17 Alexandre Oliva <aoliva@redhat.com> + PR c++/20028 + * g++.dg/template/crash34.C: New. + PR c++/20022 * g++.dg/other/access3.C: New. diff --git a/gcc/testsuite/g++.dg/template/crash34.C b/gcc/testsuite/g++.dg/template/crash34.C new file mode 100644 index 0000000..9cca62f --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash34.C @@ -0,0 +1,12 @@ +// { dg-do compile } + +// PR c++/20028 + +// We used to crash when referencing TYPE_SIZE_UNIT of the messed-up +// type used for x, because it was not initialized. + +class Foo; + +template <typename T> class Foo { }; // { dg-error "not a template type" } + +Foo<int> x; // { dg-error "not a template" } |