Bootstrapped and regtested on x86_64-pc-linux-gnu, committing as
obvious to trunk and 15.

-- >8 --

This is used in template conversion operators to determine what type the
user requested.

        PR c++/122381

gcc/cp/ChangeLog:

        * module.cc (trees_out::core_vals): Write BASELINK_OPTYPE (aka
        TREE_CHAIN).
        (trees_in::core_vals): Read it.

gcc/testsuite/ChangeLog:

        * g++.dg/modules/convop-2_a.H: New test.
        * g++.dg/modules/convop-2_b.C: New test.

Signed-off-by: Nathaniel Shead <[email protected]>
---
 gcc/cp/module.cc                          |  2 ++
 gcc/testsuite/g++.dg/modules/convop-2_a.H | 10 ++++++++++
 gcc/testsuite/g++.dg/modules/convop-2_b.C |  5 +++++
 3 files changed, 17 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/modules/convop-2_a.H
 create mode 100644 gcc/testsuite/g++.dg/modules/convop-2_b.C

diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 81357a86cfe..31f5c8146d6 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -6733,6 +6733,7 @@ trees_out::core_vals (tree t)
       WT (((lang_tree_node *)t)->baselink.binfo);
       WT (((lang_tree_node *)t)->baselink.functions);
       WT (((lang_tree_node *)t)->baselink.access_binfo);
+      WT (((lang_tree_node *)t)->baselink.common.chain);
       break;
 
     case CONSTRAINT_INFO:
@@ -7302,6 +7303,7 @@ trees_in::core_vals (tree t)
       RT (((lang_tree_node *)t)->baselink.binfo);
       RTU (((lang_tree_node *)t)->baselink.functions);
       RT (((lang_tree_node *)t)->baselink.access_binfo);
+      RT (((lang_tree_node *)t)->baselink.common.chain);
       break;
 
     case CONSTRAINT_INFO:
diff --git a/gcc/testsuite/g++.dg/modules/convop-2_a.H 
b/gcc/testsuite/g++.dg/modules/convop-2_a.H
new file mode 100644
index 00000000000..62bb2101f69
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/convop-2_a.H
@@ -0,0 +1,10 @@
+// PR c++/122381
+// { dg-additional-options "-fmodule-header" }
+// { dg-module-cmi {} }
+
+template <typename T> struct color_ref {
+  operator int() const { return 0; }
+  int foo(color_ref x) {
+    return x.operator int();
+  }
+};
diff --git a/gcc/testsuite/g++.dg/modules/convop-2_b.C 
b/gcc/testsuite/g++.dg/modules/convop-2_b.C
new file mode 100644
index 00000000000..d1e829ec70c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/convop-2_b.C
@@ -0,0 +1,5 @@
+// PR c++/122381
+// { dg-additional-options "-fmodules" }
+
+import "convop-2_a.H";
+template struct color_ref<int>;
-- 
2.51.0

Reply via email to