https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119996
Bug ID: 119996
Summary: [modules] Inline reference to a TU-local entity is
nulled when used
Product: gcc
Version: 15.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gulackeg at gmail dot com
Target Milestone: ---
Code (https://godbolt.org/z/hK4aWfMo7):
// m.cpp:
module;
#include <cstdio>
export module m;
static void f() { std::puts(__FILE__); }
export inline auto &fr = f;
// main.cpp:
#include <cassert>
import m;
int main() {
assert(&fr != nullptr);
fr();
}
GCC accepts the above code, but the variable `fr` is nulled at runtime (i.e.,
the assertion fails). This appears to be an overlooked case in the resolution
of Bug 119551.