[patch] Re: compiler crash with class nested in template class
scott snyder
snyder@d0sgif.fnal.gov
Sat May 16 17:14:00 GMT 1998
hi -
The bug reported in the appended message is still present
in recent egcs snapshots. I've tried the patch below.
This seems to fix this testcase, and doesn't cause any new regressions.
sss
Sat May 16 19:09:09 1998 scott snyder <snyder@d0sgif.fnal.gov>
* decl.c (make_typename_type): Make a non-typename type if CONTEXT
is anywhere on CURRENT_CLASS_TYPE's context chain.
--- gcc/cp/decl.c-orig Wed May 13 23:03:19 1998
+++ gcc/cp/decl.c Sat May 16 19:10:24 1998
@@ -4614,6 +4614,7 @@
{
tree t, d;
tree fullname;
+ int current_in_context = 0;
if (TREE_CODE_CLASS (TREE_CODE (name)) == 't')
name = TYPE_IDENTIFIER (name);
@@ -4631,8 +4632,24 @@
if (TREE_CODE (name) != IDENTIFIER_NODE)
my_friendly_abort (2000);
+ /* See if CONTEXT is anywhere on CURRENT_CLASS_TYPE's context chain. */
+
+ if (current_class_type)
+ {
+ tree c = current_class_type;
+ do
+ {
+ if (context == c)
+ {
+ current_in_context = 1;
+ break;
+ }
+ c = DECL_CONTEXT (TYPE_MAIN_DECL (c));
+ } while (c && AGGREGATE_TYPE_P (c));
+ }
+
if (! uses_template_parms (context)
- || context == current_class_type)
+ || current_in_context)
{
if (TREE_CODE (fullname) == TEMPLATE_ID_EXPR)
{
> To: egcs-bugs@cygnus.com
> Subject: compiler crash with class nested in template class
> Date: Tue, 31 Mar 1998 23:33:58 CST
> From: scott snyder <snyder>
>
>
> hi -
>
> For egcs 2.91.16, checked out on the afternoon of Mar. 31, on a
> mips-sgi-irix6.2 platform, the following input crashes the compiler:
>
> -- bug34.cc -----------------------------------------
> template <class Key>
> class d0om_Hashmap
> {
> public:
> class iterator
> {
> public:
> bool operator== (const iterator& x) const;
> };
> };
>
> template <class Key>
> inline
> bool d0om_Hashmap<Key>::iterator::operator==
> (const typename d0om_Hashmap<Key>::iterator& x) const
> {
> return false;
> }
> -----------------------------------------------------
>
> % cc1plus bug34.cc
> bug34.cc:16: Internal compiler error 892.
> bug34.cc:16: Please submit a full bug report to `egcs-bugs@cygnus.com'.
>
>
> thanks,
> sss
More information about the Gcc-bugs
mailing list