-
Notifications
You must be signed in to change notification settings - Fork 12.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure to compile std::u16string from libstdc++ 12.1 in c++20 mode #55560
Comments
No we didn't. The relevant change is probably jwakely/gcc@5a9572e but I don't know why that would make clang not instantiate the function it calls. |
Very odd. If I remove this function from the __attribute ((__abi_tag__ ("cxx11")))
inline basic_string<char16_t>
operator""s(const char16_t* __str, size_t __len)
{ return basic_string<char16_t>{__str, __len}; } |
And if I remove the template<typename _FwdIterator>
constexpr
void
_M_construct(_FwdIterator __beg, _FwdIterator __end,
std::forward_iterator_tag); |
@llvm/issue-subscribers-c-20 |
I think this is a small reproducer of the problem: #define INLINE constexpr
template<typename T>
INLINE
T foo(T a);
int main() {
int k = foo<int>(5);
}
template<typename T>
INLINE
T foo(T a) {
return a;
} Godbolt: https://godbolt.org/z/xoYvvbPKv The example can be fixed by defining |
The problematic code in clang is: llvm-project/clang/lib/Sema/SemaExpr.cpp Lines 17970 to 17974 in c6ad690
Replacing that |
https://reviews.llvm.org/D128119 seems to fix the issue |
@llvm/issue-subscribers-clang-frontend |
Should this be backported to the release branch? |
@tstellar any opinion? Serge isn't available right now as far as I know. |
/cherry-pick da6a14b |
Failed to cherry-pick: da6a14b https://github.com/llvm/llvm-project/actions/runs/2790868798 Please manually backport the fix and push it to your github fork. Once this is done, please add a comment like this:
|
This patch is already in the branch. |
They fail due to this bug: <llvm/llvm-project#55560>.
Cherry-pick seems to fail in 14.x locally because of the ReleaseNotes.rst Is there a mean to backport in 14.x ? ( we need this in fedora 36 in order to build chromium 108). |
There won't be any 14.x releases anymore, so you'll have to do the backport downstream |
chromium 108 error on fedora-36
|
…non-constexpr evaluation Otherwise these functions are not instantiated and we end up with an undefined symbol. Fix llvm#55560 Differential Revision: https://reviews.llvm.org/D128119
I'm getting:
error: undefined symbol: void std::__cxx11::basic_string<char16_t, std::char_traits<char16_t>, std::allocator<char16_t> >::_M_construct<char16_t const*>(char16_t const*, char16_t const*, std::forward_iterator_tag)
compiling the following simple test case:
on clang 13 and 14.0.0, with
clang++ -std=c++20 -o test test.cpp
. It works fine with-std=c++17
. Bizarrely, it also works if you simply uncomment theclang_string_workaround
line which isn't even called. It looks like libstdc++ moved that_M_construct
function into a separate file recently, which might be related.The text was updated successfully, but these errors were encountered: