https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91067

Viktor Ostashevskyi <ostash at ostash dot kiev.ua> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ostash at ostash dot kiev.ua

--- Comment #10 from Viktor Ostashevskyi <ostash at ostash dot kiev.ua> ---
What about "base object constructors" (mangled with C2)?

For simple case like:

---
#include <filesystem>
#include <iostream>

int main(int argc, char** argv)
{
  for (const auto& dirElem : std::filesystem::directory_iterator(argv[1]))
    std::cout << dirElem.path().filename() << '\n';
}
---

When compiling with Clang 8 against libstdc++ from GCC 9.2.0 I got:

in function
`std::filesystem::directory_iterator::directory_iterator(std::filesystem::directory_iterator&&)':
fs.cpp:(.text._ZNSt10filesystem18directory_iteratorC2EOS0_[_ZNSt10filesystem18directory_iteratorC2EOS0_]+0x1):
undefined reference to `std::__shared_ptr<std::filesystem::_Dir,
(__gnu_cxx::_Lock_policy)2>::__shared_ptr(std::__shared_ptr<std::filesystem::_Dir,
(__gnu_cxx::_Lock_policy)2>&&)'


Checking in libstdc++.so showed that symbols are exported, but only for
complete object constructor:

_ZNSt12__shared_ptrINSt10filesystem7__cxx114_DirELN9__gnu_cxx12_Lock_policyE2EEC1EOS5_

Not sure why, but Clang emits call to base object constructor:

_ZNSt12__shared_ptrINSt10filesystem7__cxx114_DirELN9__gnu_cxx12_Lock_policyE2EEC2EOS5_


I've checked Clang8 vs libstdc++ from GCC 8.3.0 and see that it emits calls to
same base object ctor, but its definition is also emitted, so no linker error
occur.

Reply via email to