-
Notifications
You must be signed in to change notification settings - Fork 226
Errror with C++ module #2419
Description
GCC 15: C++ Modules fail with "exposes TU-local entity" errors
Library version: (please fill in your glaze version)
Compiler: GCC 15
Standard: C++26 (with -fmodules-ts)
Platform: Fedora Linux 43
Problem
When using glaze headers inside C++20/26 module interface units (.cppm),
GCC 15 rejects compilation with errors of the form:
error: 'some_function' exposes TU-local entity 'glz::tag::null'
note: 'glz::tag::null' declared with internal linkage
GCC 15 introduced stricter enforcement of [basic.link] / [module.reach]:
a module interface unit must not expose entities with internal linkage
(TU-local entities) in any reachable declaration.
Root cause
Several glaze headers define constants with internal linkage, then use them
in inline/template function signatures that become part of the module
interface:
glaze/beve/header.hpp
// These have internal linkage (no namespace, file-scope constexpr)
constexpr uint8_t null = 0;
constexpr uint8_t number = 1;
constexpr uint8_t string = 2;
constexpr uint8_t object = 3;
constexpr uint8_t typed_array = 4;
constexpr uint8_t generic_array = 5;
constexpr uint8_t boolean = 0b00001'000;
constexpr uint8_t bool_true = 0b000'11'000;glaze/util/fast_float.hpp
constexpr static int32_t invalid_am_bias = -0x8000;
constexpr size_t limb_bits = 64;
constexpr static uint64_t powers_of_ten_uint64[] = {...};
template <typename UC> static constexpr int int_cmp_len() {...}
template <typename UC> static constexpr uint64_t int_cmp_zeros() {...}glaze/util/simple_float.hpp
static constexpr int32_t max_exp10 = 400;glaze/util/parse.hpp
constexpr uint32_t generic_surrogate_mask = 0xF800;glaze/reflection/to_tuple.hpp
constexpr size_t max_pure_reflection_count = 128;These are all TU-local (internal linkage). Functions/templates that
reference them in their signatures (return types, parameters, or bodies
visible to the module consumer) violate C++ Modules rules under GCC 15.
Minimal reproduction
// my_module.cppm
module;
#include <glaze/glaze.hpp>
export module my_module;
export struct Foo { int x; std::string y; };
// Compiling this with:
// g++ -std=gnu++26 -fmodules-ts -x c++ -c my_module.cppm
// → dozens of "exposes TU-local entity" errors