https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85818
Bug ID: 85818 Summary: [8/9 Regression] undefined reference to `std::experimental::filesystem::v1::__cxx11::path::pre ferred_separator' Product: gcc Version: 8.1.1 Status: UNCONFIRMED Keywords: link-failure Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- This fails to link when compiled as C++11 or C++14 with GCC 8 or 9: #include <experimental/filesystem> int main() { auto& sep = std::experimental::filesystem::path::preferred_separator; } /tmp/ccxrMmnw.o: In function `main': /tmp/ps.cc:5: undefined reference to `std::experimental::filesystem::v1::__cxx11::path::preferred_separator' collect2: error: ld returned 1 exit status The variable is defined in src/filesystem/path.cc: constexpr path::value_type path::preferred_separator; But that file is compiled with -std=gnu++17 and so the variable is implicitly inline, and because it isn't used in that file its definition isn't emitted in path.o