This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ PATCH, committed] [PR12355] ICE on pseudo destructor call


Hello,

this simple ICE on the qualified-id form of a pseudo destructor call can be
fixed by noticing that cp_parser_lookup_name is expected to return
error_mark_node when a name couldn't be looked up. Instead, in case of a
BIT_NOT_EXPR, it was returning NULL if there was no user destructor declared in
the class. Fixed thus.

The testcase contains dg-bogus xfail because the code is in fact valid due to
DR 272, but it is not yet accepted by GCC: This issue is already filed as PR
12333.

Tested on i686-pc-linux-gnu, I will commit this tomorrow as obvious (allowing
24h in case I'm missing something obvious).

Giovanni Bajo


2004-01-13  Giovanni Bajo  <giovannibajo@gcc.gnu.org>

        PR c++/12335
        * parser.c (cp_parser_lookup_name): Return error_mark_node if there
        is no destructor while looking up a BIT_NOT_EXPR.

2004-01-13  Giovanni Bajo  <giovannibajo@gcc.gnu.org>

        PR c++/12335
        * g++.dg/parse/dtor3.C: New test.


Index: parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.147
diff -c -3 -p -r1.147 parser.c
*** parser.c    5 Jan 2004 21:07:20 -0000       1.147
--- parser.c    13 Jan 2004 03:43:37 -0000
*************** cp_parser_lookup_name (cp_parser *parser
*** 13350,13355 ****
--- 13361,13368 ----
        /* If that's not a class type, there is no destructor.  */
        if (!type || !CLASS_TYPE_P (type))
        return error_mark_node;
+       if (!CLASSTYPE_DESTRUCTORS (type))
+         return error_mark_node;
        /* If it was a class type, return the destructor.  */
        return CLASSTYPE_DESTRUCTORS (type);
      }


// { dg-do compile }
// Contributed by Wolfgang Bangerth <bangerth at dealii dot org>
// PR c++/12335: Make sure we don't ICE on the qualified-id form of a
//  destructor call.

struct Y {
  ~Y() {}      // { dg-bogus "note" "not implemented DR272" { xfail *-*-* } }
};

struct X : Y {
  ~X() {}      // { dg-bogus "note" "not implemented DR272" { xfail *-*-* } }
  void f() {
    X::~X();   // { dg-bogus "" "not implemented DR272" { xfail *-*-* } }
    Y::~Y();   // { dg-bogus "" "not implemented DR272" { xfail *-*-* } }
  }
};



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]