aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2015-05-31 21:47:28 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2015-05-31 21:47:28 +0000
commit1edfb384e845bc80dbb86a01373ffaeef37aeaec (patch)
tree4312a75694ade877696a8a80780473b127951ff5 /gcc
parent255a48d6419c185cd9daac578a97b22e2c71b596 (diff)
downloadgcc-1edfb384e845bc80dbb86a01373ffaeef37aeaec.zip
gcc-1edfb384e845bc80dbb86a01373ffaeef37aeaec.tar.gz
gcc-1edfb384e845bc80dbb86a01373ffaeef37aeaec.tar.bz2
c-ada-spec.c (is_tagged_type): Test for TYPE_METHODS on main variant.
* c-ada-spec.c (is_tagged_type): Test for TYPE_METHODS on main variant. (has_nontrivial_methods): Likewise. From-SVN: r223905
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c-ada-spec.c6
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/other/dump-ada-spec-4.C18
4 files changed, 33 insertions, 0 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index df874d6..abcc2a7 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-31 Eric Botcazou <ebotcazou@adacore.com>
+
+ * c-ada-spec.c (is_tagged_type): Test for TYPE_METHODS on main variant.
+ (has_nontrivial_methods): Likewise.
+
2015-05-25 Marek Polacek <polacek@redhat.com>
* c-ubsan.c (ubsan_instrument_shift): Use type0.
diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c
index b4e159e..9bef522 100644
--- a/gcc/c-family/c-ada-spec.c
+++ b/gcc/c-family/c-ada-spec.c
@@ -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))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 45ae35b..7d9e46d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2015-05-31 Eric Botcazou <ebotcazou@adacore.com>
+
+ * g++.dg/other/dump-ada-spec-4.C: New test.
+
2015-05-30 H.J. Lu <hongjiu.lu@intel.com>
* gcc.dg/alias-8.c: Fix dg-warning.
diff --git a/gcc/testsuite/g++.dg/other/dump-ada-spec-4.C b/gcc/testsuite/g++.dg/other/dump-ada-spec-4.C
new file mode 100644
index 0000000..bdbbda4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/dump-ada-spec-4.C
@@ -0,0 +1,18 @@
+/* { 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 } } */