]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c-ada-spec.c (dump_ada_template): Bail out for template declarations declaring someth...
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Thu, 11 Oct 2012 10:29:54 +0000 (10:29 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Thu, 11 Oct 2012 10:29:54 +0000 (10:29 +0000)
* c-ada-spec.c (dump_ada_template): Bail out for template declarations
declaring something coming from another file.

From-SVN: r192353

gcc/c-family/ChangeLog
gcc/c-family/c-ada-spec.c

index 9a438f038f0b71b230a3469f67df63c0a8c2a59f..04b6971fef76cdc60f867ee36cfc006441096eb4 100644 (file)
@@ -1,6 +1,11 @@
+2012-10-11  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * c-ada-spec.c (dump_ada_template): Bail out for template declarations
+       declaring something coming from another file.
+
 2012-10-10  Arnaud Charlet  <charlet@adacore.com>
 
-PR ada/54845
+       PR ada/54845
        * c-ada-spec.c (print_ada_struct_decl): Increase buf size.
 
 2012-10-09  Paolo Carlini  <paolo.carlini@oracle.com>
index 36a86e5abd500984a054a385b21fd80e3232ccc6..631ee7a5843a4a0b5b0a24d6067c02cd93f693dd 100644 (file)
@@ -1700,10 +1700,18 @@ static int
 dump_ada_template (pretty_printer *buffer, tree t,
                   int (*cpp_check)(tree, cpp_operation), int spc)
 {
-  tree inst = DECL_VINDEX (t);
   /* 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);
   int num_inst = 0;
 
+  /* Don't look at template declarations declaring something coming from
+     another file.  This can occur for template friend declarations.  */
+  if (LOCATION_FILE (decl_sloc (result, false))
+      != LOCATION_FILE (decl_sloc (t, false)))
+    return 0;
+
   while (inst && inst != error_mark_node)
     {
       tree types = TREE_PURPOSE (inst);