https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124443
Bug ID: 124443
Summary: hard error in define_static_object with volatile
object
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: hewillk at gmail dot com
Target Milestone: ---
#include <meta>
int main() {
constexpr volatile int i = 42;
std::define_static_object(i);
}
https://godbolt.org/z/4PMachs4P
The standard specifies returning span(std::addressof(t), 1)), but libstdc++
returns a span<const U>(std::addressof(t), 1)).
This inconsistency leads to the hard error mentioned above.
It's unclear whether we need to strictly adhere to the wording, since the code
is still ill-formed.