Jan changed TYPE_METHODS to be present only on the main variant so a couple of
predicates in c-ada-spec.c need to be adjusted accordingly.
Tested on x86_64-suse-linux, applied on the mainline as obvious.
2015-05-31 Eric Botcazou <ebotca...@adacore.com>
* c-ada-spec.c (is_tagged_type): Test for TYPE_METHODS on main variant.
(has_nontrivial_methods): Likewise.
2015-05-31 Eric Botcazou <ebotca...@adacore.com>
* g++.dg/other/dump-ada-spec-4.C: New test.
--
Eric Botcazou
Index: c-ada-spec.c
===================================================================
--- c-ada-spec.c (revision 223897)
+++ c-ada-spec.c (working copy)
@@ -960,6 +960,9 @@ is_tagged_type (const_tree type)
if (!type || !RECORD_OR_UNION_TYPE_P (type))
return false;
+ /* TYPE_METHODS is only set on the main variant. */
+ type = TYPE_MAIN_VARIANT (type);
+
for (tmp = TYPE_METHODS (type); tmp; tmp = TREE_CHAIN (tmp))
if (TREE_CODE (tmp) == FUNCTION_DECL && DECL_VINDEX (tmp))
return true;
@@ -988,6 +991,9 @@ has_nontrivial_methods (tree type)
if (!cpp_check (type, IS_TRIVIAL))
return true;
+ /* TYPE_METHODS is only set on the main variant. */
+ type = TYPE_MAIN_VARIANT (type);
+
/* If there are user-defined methods, they are deemed non-trivial. */
for (tmp = TYPE_METHODS (type); tmp; tmp = TREE_CHAIN (tmp))
if (!DECL_ARTIFICIAL (tmp))
/* { dg-do compile } */
/* { dg-options "-fdump-ada-spec" } */
class Root {
public:
virtual void copyFrom(const Root& property) = 0;
};
class DT : Root {
virtual void copyFrom (const Root& property);
/* Although in C++ the type of argument Root is the parent type
"Root", in order to properly override this primitive in Ada
the profile of the generated function must be the derived
type "DT" */
};
/* { dg-final { scan-ada-spec "Root'Class" } } */
/* { dg-final { cleanup-ada-spec } } */