https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94679
Bug ID: 94679 Summary: link time error: undefined reference to std::projected<...>::operator *() const Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: okannen at gmail dot com Target Milestone: --- Host: x86_64-pc-linux-gnu Target: x86_64 Build: x86_64-pc-linux-gnu When compiling with -coverage -fkeep-inline-functions, it is possible to get a linkage error: 'undefined reference to `std::projected<int*,std::identity>::operator*() const' gcc --version: gcc (GCC) 10.0.1 20200416 (experimental) Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. gcc -v: Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/home/olivier/usr/libexec/gcc/x86_64-pc-linux-gnu/10/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --enable-libsanitizer --prefix=/home/olivier/usr/ --with-gcc-major-version-only --disable-bootstrap --enable-language=c,c++,lto Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.0.1 20200416 (experimental) (GCC) The following code compiled with: 'c++ -coverage -fkeep-inline-functions -std=c++20 file.cpp' #include <algorithm> int main(){ int a[]={1,2,3}; std::ranges::next_permutation(a); return 0; } This produce error message: /usr/bin/ld: /tmp/ccF8BXBM.o: in function `decltype(auto) std::ranges::__cust_imove::_IMove::operator()<std::projected<int*, std::identity>&>(std::projected<int*, std::identity>&) const': test.cpp:(.text._ZNKSt6ranges12__cust_imove6_IMoveclIRSt9projectedIPiSt8identityEEEDcOT_[_ZNKSt6ranges12__cust_imove6_IMoveclIRSt9projectedIPiSt8identityEEEDcOT_]+0x2a): undefined reference to `std::projected<int*, std::identity>::operator*() const' /usr/bin/ld: /tmp/ccF8BXBM.o: in function `decltype(auto) std::ranges::__cust_imove::_IMove::operator()<std::projected<int*, std::identity> const&>(std::projected<int*, std::identity> const&) const': test.cpp:(.text._ZNKSt6ranges12__cust_imove6_IMoveclIRKSt9projectedIPiSt8identityEEEDcOT_[_ZNKSt6ranges12__cust_imove6_IMoveclIRKSt9projectedIPiSt8identityEEEDcOT_]+0x2a): undefined reference to `std::projected<int*, std::identity>::operator*() const' collect2: error: ld returned 1 exit status