[Bug libstdc++/85818] New: [8/9 Regression] undefined reference to `std::experimental::filesystem::v1::__cxx11::path::preferred_separator'

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 17 12:02:00 GMT 2018


            Bug ID: 85818
           Summary: [8/9 Regression] undefined reference to
           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
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

More information about the Gcc-bugs mailing list