[PATCH] D148953: [llvm][ADT] Fix Any linker error with multiple compilers
Philippe Renon via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 25 09:43:07 PDT 2023
filnet added a comment.
This is what happened.
Prior to 16..0.0 that one line was like follows (note the const qualifier) and everybody was happy:
template <typename T> const char Any::TypeId<T>::Id = 0;
In 1.6.0 the const qualifier was removed as follows to work around a MSVC bug:
template <typename T> char Any::TypeId<T>::Id = 0;
This caused the definition to be moved to a different segment which broke the MSYS2 build of Rust.
This fix changed that line again to:
template <typename T> char Any::TypeId<T>::Id = 1;
Which apparently moved the definition back to where it was, looping the loop, and making everybody happy again.
My take on all this is that there is no compiler bug. Where these kind of constructs end up is a bit of a grey area.
Compilers do it differently but there are options to force a behavior or another.
I did not do a deep dive in this area but I am keeping it in mind should similar issues appear in the future.
And I believe there is an ongoing effort to replace `llvm::Any` with `std::Any`.
Once that is done then this particular piece of code will become someone else's problem.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148953/new/
https://reviews.llvm.org/D148953
More information about the llvm-commits
mailing list