They were introduced by the latest tree structure re-shuffling.

Tested on x86_64-suse-linux, applied on the mainline as obvious.


2015-03-01  Eric Botcazou  <ebotca...@adacore.com>

        * c-ada-spec.c (is_tagged_type): Add guard for DECL_VINDEX.
        (dump_template_types): Adjust DECL_TEMPLATE_INSTANTIATIONS and
        DECL_TEMPLATE_RESULT emulations.
        (dump_ada_template)): Add guard for TYPE_METHODS.


2015-03-01  Eric Botcazou  <ebotca...@adacore.com>

        * g++.dg/other/dump-ada-spec-3.C: New test.


-- 
Eric Botcazou
Index: c-family/c-ada-spec.c
===================================================================
--- c-family/c-ada-spec.c	(revision 220958)
+++ c-family/c-ada-spec.c	(working copy)
@@ -961,7 +961,7 @@ is_tagged_type (const_tree type)
     return false;
 
   for (tmp = TYPE_METHODS (type); tmp; tmp = TREE_CHAIN (tmp))
-    if (DECL_VINDEX (tmp))
+    if (TREE_CODE (tmp) == FUNCTION_DECL && DECL_VINDEX (tmp))
       return true;
 
   return false;
@@ -1730,10 +1730,15 @@ dump_template_types (pretty_printer *buf
 static int
 dump_ada_template (pretty_printer *buffer, tree t, int spc)
 {
-  /* DECL_VINDEX is DECL_TEMPLATE_INSTANTIATIONS in this context.  */
-  tree inst = DECL_VINDEX (t);
-  /* DECL_RESULT_FLD is DECL_TEMPLATE_RESULT in this context.  */
-  tree result = DECL_RESULT_FLD (t);
+  /* DECL_SIZE_UNIT is DECL_TEMPLATE_INSTANTIATIONS in this context.  */
+  tree inst = DECL_SIZE_UNIT (t);
+  /* This emulates DECL_TEMPLATE_RESULT in this context.  */
+  struct tree_template_decl {
+    struct tree_decl_common common;
+    tree arguments;
+    tree result;
+  };
+  tree result = ((struct tree_template_decl *) t)->result;
   int num_inst = 0;
 
   /* Don't look at template declarations declaring something coming from
@@ -1750,7 +1755,7 @@ dump_ada_template (pretty_printer *buffe
       if (TREE_VEC_LENGTH (types) == 0)
 	break;
 
-      if (!TYPE_P (instance) || !TYPE_METHODS (instance))
+      if (!RECORD_OR_UNION_TYPE_P (instance) || !TYPE_METHODS (instance))
 	break;
 
       num_inst++;
/* { dg-do compile } */
/* { dg-options "-fdump-ada-spec" } */

#include <iostream>

using namespace std;

class Base {
   public:
     int My_V;
     virtual void Primitive ();

     Base ();
};

void Base::Primitive () {
  cout << "C++ Primitive  " << this->My_V << "\n";
}

Base::Base () {
}

void Dispatch (Base * B) {
  B->Primitive ();
}

/* { dg-final { cleanup-ada-spec } } */

Reply via email to