circle
circle copied to clipboard
link error with std::filesystem::directory_iterator of libstdc++
$ circle --version
circle version 1.0.0-161
Circle public preview build 161
Built Feb 23 2022 11:54:40
(c) 2022 Sean Baxter
https://www.circle-lang.org/
Twitter: @seanbax
$ cat test.cpp
#include<filesystem>
int main(){
std::filesystem::directory_iterator it{"/tmp"};
}
$ circle -std=c++17 test.cpp
/usr/bin/ld: /tmp/circle-tmp-dir-WxL1d5/test.o: in function `main':
test.cpp:(.text+0x5a): undefined reference to `std::__shared_ptr<std::filesystem::__cxx11::_Dir, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr()'
error: linker failed with exit code 1
Surprising bug. Circle sees this extern template declaration and therefore doesn't do implicit instantiation of the destructor: fs_dir.h:
// Use explicit instantiations of these types. Any inconsistency in the
// value of __default_lock_policy between code including this header and
// the library will cause a linker error.
extern template class
__shared_ptr<filesystem::_Dir>;
I'll check it out.