https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103629
--- Comment #25 from Mathieu Malaterre <malat at debian dot org> ---
Looks like there is an easy fix (work-around?):
% cat Tree.h
#pragma once
#include <memory>
#include <mutex>
class
#ifdef VIS
__attribute__((visibility("default")))
#endif
Tree {
public:
static const std::string treeType() {
static std::once_flag once;
std::call_once(once, []() {
std::printf("%p\n", &sTreeTypeName);
sTreeTypeName.reset(new std::string());
});
std::printf("%p\n", &sTreeTypeName);
if (!sTreeTypeName)
throw "uhoh";
return *sTreeTypeName;
}
private:
static std::unique_ptr<const std::string> sTreeTypeName;
};
std::unique_ptr<const std::string> Tree::sTreeTypeName;