cp-tree.def (PSEUDO_DTOR_EXPR): New tree code.
authorMark Mitchell <mark@codesourcery.com>
Thu, 19 Aug 1999 08:06:17 +0000 (08:06 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 19 Aug 1999 08:06:17 +0000 (08:06 +0000)
* cp-tree.def (PSEUDO_DTOR_EXPR): New tree code.
* decl2.c (build_expr_from_tree): Handle it.
* error.c (dump_expr): Likewise.
* pt.c (for_each_template_parm): Likewise.
(tsubst_copy): Likewise.
* tree.c (search_tree): Likewise.
* semantics.c (finish_pseudo_destructor_call): Create it.

From-SVN: r28760

gcc/cp/ChangeLog
gcc/cp/cp-tree.def
gcc/cp/decl2.c
gcc/cp/error.c
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/cp/tree.c
gcc/testsuite/g++.old-deja/g++.pt/crash48.C [new file with mode: 0644]

index 6e44c4f..443cdd5 100644 (file)
@@ -1,3 +1,13 @@
+1999-08-19  Mark Mitchell  <mark@codesourcery.com>
+
+       * cp-tree.def (PSEUDO_DTOR_EXPR): New tree code.
+       * decl2.c (build_expr_from_tree): Handle it.
+       * error.c (dump_expr): Likewise.
+       * pt.c (for_each_template_parm): Likewise.
+       (tsubst_copy): Likewise.
+       * tree.c (search_tree): Likewise.
+       * semantics.c (finish_pseudo_destructor_call): Create it.
+       
 1999-08-18  Mark Mitchell  <mark@codesourcery.com>
 
        * search.c (setup_class_bindings): Robustify.
index 1970922..d31d33e 100644 (file)
@@ -214,6 +214,7 @@ DEFTREECODE (ALIGNOF_EXPR, "alignof_expr", '1', 1)
 DEFTREECODE (ARROW_EXPR, "arrow_expr", 'e', 1)
 DEFTREECODE (DOTSTAR_EXPR, "dotstar_expr", 'e', 2)
 DEFTREECODE (TYPEID_EXPR, "typeid_expr", 'e', 1)
+DEFTREECODE (PSEUDO_DTOR_EXPR, "pseudo_dtor_expr", 'e', 3)
 
 DEFTREECODE (EXPR_STMT, "expr_stmt", 'e', 1)
 DEFTREECODE (COMPOUND_STMT, "compound_stmt", 'e', 1)
index a0a7e6c..ecfdd61 100644 (file)
@@ -3992,6 +3992,12 @@ build_expr_from_tree (t)
         build_expr_from_tree (TREE_OPERAND (t, 1)),
         build_expr_from_tree (TREE_OPERAND (t, 2)));
 
+    case PSEUDO_DTOR_EXPR:
+      return (finish_pseudo_destructor_call_expr 
+             (build_expr_from_tree (TREE_OPERAND (t, 0)),
+              build_expr_from_tree (TREE_OPERAND (t, 1)),
+              build_expr_from_tree (TREE_OPERAND (t, 2))));
+
     case TREE_LIST:
       {
        tree purpose, value, chain;
index ce0ffbf..b6598ff 100644 (file)
@@ -1776,6 +1776,14 @@ dump_expr (t, nop)
       dump_expr (TREE_OPERAND (t, 0), nop);
       break;
 
+    case PSEUDO_DTOR_EXPR:
+      dump_expr (TREE_OPERAND (t, 2), nop);
+      OB_PUTS (".");
+      dump_type (TREE_OPERAND (t, 0), nop);
+      OB_PUTS ("::~");
+      dump_type (TREE_OPERAND (t, 1), nop);
+      break;
+
     case TEMPLATE_ID_EXPR:
       dump_decl (t, 0);
       break;
index 9a31d60..e1e8ab4 100644 (file)
@@ -4300,6 +4300,7 @@ for_each_template_parm (t, fn, data)
     case DOTSTAR_EXPR:
     case TYPEID_EXPR:
     case LOOKUP_EXPR:
+    case PSEUDO_DTOR_EXPR:
       if (!fn)
        return 1;
       /* Fall through.  */
@@ -7078,6 +7079,7 @@ tsubst_copy (t, args, complain, in_decl)
 
     case COND_EXPR:
     case MODOP_EXPR:
+    case PSEUDO_DTOR_EXPR:
       {
        r = build_nt
          (code, tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl),
index dc6b541..def1276 100644 (file)
@@ -1229,6 +1229,9 @@ finish_pseudo_destructor_call_expr (object, scope, destructor)
      tree scope;
      tree destructor;
 {
+  if (processing_template_decl)
+    return build_min_nt (PSEUDO_DTOR_EXPR, object, scope, destructor);
+
   if (scope && scope != destructor)
     cp_error ("destructor specifier `%T::~%T()' must have matching names", 
              scope, destructor);
index d159ac1..8d36753 100644 (file)
@@ -1675,6 +1675,7 @@ search_tree (t, func)
     case ARROW_EXPR:
     case DOTSTAR_EXPR:
     case TYPEID_EXPR:
+    case PSEUDO_DTOR_EXPR:
       break;
 
     case COMPLEX_CST:
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash48.C b/gcc/testsuite/g++.old-deja/g++.pt/crash48.C
new file mode 100644 (file)
index 0000000..907360b
--- /dev/null
@@ -0,0 +1,8 @@
+// Build don't link:
+// Origin: Jean-Francois Panisset <panisset@discreet.com>
+
+template<class T>
+void foo(T *data)
+{
+  ((char *)data)->~T();
+}