diff --git a/src/abg-default-reporter.cc b/src/abg-default-reporter.cc
index 9940fc07..a5cebef4 100644
--- a/src/abg-default-reporter.cc
+++ b/src/abg-default-reporter.cc
@@ -1575,19 +1575,26 @@ default_reporter::report(const function_decl_diff& d, ostream& out,
 	      << " to " << sf_vtable_offset << "\n";
 	}
 
-      // the classes of the two member functions.
-      class_decl_sptr fc =
-	is_class_type(is_method_type(ff->get_type())->get_class_type());
-      class_decl_sptr sc =
-	is_class_type(is_method_type(sf->get_type())->get_class_type());
+      // the parent types (classe or union) of the two member
+      // functions.
+      class_or_union_sptr f =
+	is_class_or_union_type(is_method_type(ff->get_type())->get_class_type());
+      class_or_union_sptr s =
+	is_class_or_union_type(is_method_type(sf->get_type())->get_class_type());
+
+      class_decl_sptr fc = is_class_type(f);
+      class_decl_sptr sc = is_class_type(s);
 
       // Detect if the virtual member function changes above
       // introduced a vtable change or not.
       bool vtable_added = false, vtable_removed = false;
-      if (!fc->get_is_declaration_only() && !sc->get_is_declaration_only())
+      if (!f->get_is_declaration_only() && !s->get_is_declaration_only())
 	{
-	  vtable_added = !fc->has_vtable() && sc->has_vtable();
-	  vtable_removed = fc->has_vtable() && !sc->has_vtable();
+	  if (fc && sc)
+	    {
+	      vtable_added = !fc->has_vtable() && sc->has_vtable();
+	      vtable_removed = fc->has_vtable() && !sc->has_vtable();
+	    }
 	}
       bool vtable_changed = ((ff_is_virtual != sf_is_virtual)
 			     || (ff_vtable_offset != sf_vtable_offset));
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 0b406f3b..ab3d2490 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -927,6 +927,11 @@ test-diff-filter/test-PR27331-report-0.txt   \
 test-diff-filter/test-PR27569-v0.abi	     \
 test-diff-filter/test-PR27569-v1.abi         \
 test-diff-filter/test-PR27569-report-0.txt   \
+test-diff-filter/test-PR27598-v0.cc          \
+test-diff-filter/test-PR27598-v0.o           \
+test-diff-filter/test-PR27598-v1.cc          \
+test-diff-filter/test-PR27598-v1.o           \
+test-diff-filter/test-PR27598-report-0.txt   \
 \
 test-diff-suppr/test0-type-suppr-v0.cc	\
 test-diff-suppr/test0-type-suppr-v1.cc	\
diff --git a/tests/data/test-diff-filter/test-PR27598-report-0.txt b/tests/data/test-diff-filter/test-PR27598-report-0.txt
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/data/test-diff-filter/test-PR27598-v0.cc b/tests/data/test-diff-filter/test-PR27598-v0.cc
new file mode 100644
index 00000000..b31dee45
--- /dev/null
+++ b/tests/data/test-diff-filter/test-PR27598-v0.cc
@@ -0,0 +1,14 @@
+union S
+{
+  void bar() const
+  {
+  }
+
+  int needed;
+};
+
+void
+fun(S s)
+{
+  s.bar();
+}
diff --git a/tests/data/test-diff-filter/test-PR27598-v0.o b/tests/data/test-diff-filter/test-PR27598-v0.o
new file mode 100644
index 0000000000000000000000000000000000000000..146c539a484970ee6b8d541cba121b15f97cfe77
GIT binary patch
diff --git a/tests/data/test-diff-filter/test-PR27598-v1.cc b/tests/data/test-diff-filter/test-PR27598-v1.cc
new file mode 100644
index 00000000..67bb3ee2
--- /dev/null
+++ b/tests/data/test-diff-filter/test-PR27598-v1.cc
@@ -0,0 +1,12 @@
+union S
+{
+  void bar() const
+  {
+  }
+};
+
+void
+fun(S s)
+{
+  s.bar();
+}
diff --git a/tests/data/test-diff-filter/test-PR27598-v1.o b/tests/data/test-diff-filter/test-PR27598-v1.o
new file mode 100644
index 0000000000000000000000000000000000000000..7015d7a8d0904b47f9edbe4ebc63e575c82a0f9e
GIT binary patch
diff --git a/tests/test-diff-filter.cc b/tests/test-diff-filter.cc
index 0b6b6588..acf2d62f 100644
--- a/tests/test-diff-filter.cc
+++ b/tests/test-diff-filter.cc
@@ -793,6 +793,13 @@ InOutSpec in_out_specs[] =
    "--no-default-suppression",
    "data/test-diff-filter/test-PR27569-report-0.txt",
    "output/test-diff-filter/test-PR27569-report-0.txt",
+  },
+    {
+   "data/test-diff-filter/test-PR27598-v0.o",
+   "data/test-diff-filter/test-PR27598-v0.o",
+   "--no-default-suppression",
+   "data/test-diff-filter/test-PR27598-report-0.txt",
+   "output/test-diff-filter/test-PR27598-report-0.txt",
   },
   // This should be the last entry
   {NULL, NULL, NULL, NULL, NULL}
