Tested x86_64-pc-linux-gnu, applying to trunk.

-- 8< --

My contracts-in-libstdc++ experiment had trouble with <meta> because the
forward-declaration of source_location didn't have TREE_PUBLIC set.  And
let's also adjust the C++98 bad_alloc decl for consistency.

gcc/cp/ChangeLog:

        * contracts.cc (lookup_std_type): Set TREE_PUBLIC.
        (lookup_std_contracts_type): Likewise.
        * decl.cc (cxx_init_operator_new_delete_decls): Likewise.
---
 gcc/cp/contracts.cc | 2 ++
 gcc/cp/decl.cc      | 1 +
 2 files changed, 3 insertions(+)

diff --git a/gcc/cp/contracts.cc b/gcc/cp/contracts.cc
index cd5f0bdbb16..fe2cd3a5d25 100644
--- a/gcc/cp/contracts.cc
+++ b/gcc/cp/contracts.cc
@@ -365,6 +365,7 @@ lookup_std_type (tree name_id)
       create_implicit_typedef (name_id, res_type);
       DECL_SOURCE_LOCATION (TYPE_NAME (res_type)) = BUILTINS_LOCATION;
       DECL_CONTEXT (TYPE_NAME (res_type)) = current_namespace;
+      TREE_PUBLIC (TYPE_NAME (res_type)) = true;
       pushdecl_namespace_level (TYPE_NAME (res_type), /*hidden*/true);
       pop_nested_namespace (std_node);
     }
@@ -2441,6 +2442,7 @@ lookup_std_contracts_type (tree name_id)
       create_implicit_typedef (name_id, res_type);
       DECL_SOURCE_LOCATION (TYPE_NAME (res_type)) = BUILTINS_LOCATION;
       DECL_CONTEXT (TYPE_NAME (res_type)) = current_namespace;
+      TREE_PUBLIC (TYPE_NAME (res_type)) = true;
       pushdecl_namespace_level (TYPE_NAME (res_type), /*hidden*/true);
       pop_namespace ();
       pop_nested_namespace (std_node);
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index d45730a13f6..75990e41219 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -5541,6 +5541,7 @@ cxx_init_operator_new_delete_decls (void)
       bad_alloc_decl
        = create_implicit_typedef (bad_alloc_id, bad_alloc_type_node);
       DECL_CONTEXT (bad_alloc_decl) = current_namespace;
+      TREE_PUBLIC (bad_alloc_decl) = true;
       pop_nested_namespace (std_node);
 
       new_eh_spec

base-commit: 946f1fefc6d44afad2d3ff1e6a5fe74387bb3aea
-- 
2.56.0

Reply via email to