[libcxx-commits] [PATCH] D153709: [libc++] Implement stringbuf members of P0408R7 (Efficient Access to basic_stringbuf's Buffer)

Piotr Fusik via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 11 11:07:46 PDT 2023


pfusik added inline comments.


================
Comment at: libcxx/include/sstream:337
+#else
+    _LIBCPP_HIDE_FROM_ABI string_type str() const & { return str(__str_.get_allocator()); }
+
----------------
hans wrote:
> pfusik wrote:
> > hans wrote:
> > > This is causing link errors for us on Windows. (https://crbug.com/1463881)
> > > 
> > > The problem is that `sstream` has an explicit instantiation declaration of `basic_stringbuf<char>` in the `sstream` header, but when compiling the instantiation in `ios.instantiations.cpp`, `_LIBCPP_BUILDING_LIBRARY` is defined and so this `string_type str() const &` member function doesn't get defined.
> > > 
> > > (Apologies for the late report; we were blocked on https://reviews.llvm.org/D151953#4472195 until yesterday.)
> > `str() const &` is `_LIBCPP_HIDE_FROM_ABI` so I think it should NOT be linked.
> > Why is it `__declspec(dllimport)` ?
> The explicit instantiation decl uses `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS` which is dllimport: https://github.com/llvm/llvm-project/blob/main/libcxx/include/__config#L564
> 
> I think the idea is that _LIBCPP_HIDE_FROM_ABI should exclude the method from the explicit instantiation but that attribute doesn't seem to be really working with dllimport: https://godbolt.org/z/qc3zfvdaa
Is this issue specific to the `str() const &` overload?
How do the other `_LIBCPP_HIDE_FROM_ABI` members work? Are they `dllimport` too?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153709/new/

https://reviews.llvm.org/D153709



More information about the libcxx-commits mailing list