[PATCH] D103935: Add Twine support for std::string_view.
James Y Knight via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 15 05:52:40 PDT 2021
jyknight added a comment.
In D103935#2879061 <https://reviews.llvm.org/D103935#2879061>, @tstellar wrote:
> This patch causes segmentation faults when you have an application compiled with -std=c++17 (The current gcc default) and libLLVM.so compiled with c++14 (The current LLVM project default). Is this a valid use case or do we require that all library users use the same c++ version as the library.
The most immediate reason is the enum value `StdStringViewKind` has an (unnecessary) #ifdef around it. Making that unconditional seems entirely reasonable, and is easy enough.
But, even with that, compiling with different standards versions will result in an ODR violation in getSingleStringRef(), which may or may not cause a problem, depending on whether it's inlined, and whether the C++14-compiled version of it wins the link choice. Also, if llvm itself is compiled with c++14 while the consumer is compiled with c++17, the various print methods defined in the cpp file will not work either.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103935/new/
https://reviews.llvm.org/D103935
More information about the llvm-commits
mailing list