https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94241
Bug ID: 94241
Summary: ranges::find_if doesn't like data structures defined
in a function
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: cjdb.ns at gmail dot com
Target Milestone: ---
ranges::find_if chucks a wobbly when a struct is defined inside a function.
Seems to cooperate if the struct is in global scope.
# Diagnostic
```
In file included from
/usr/local/include/c++/10.0.1/bits/stl_iterator_base_types.h:71,
from /usr/local/include/c++/10.0.1/bits/stl_algobase.h:65,
from /usr/local/include/c++/10.0.1/algorithm:61,
from ice.cpp:1:
/usr/local/include/c++/10.0.1/bits/iterator_concepts.h:669:40: error:
'std::indirect_result_t<_Proj&, _Iter> std::projected<_Iter,
_Proj>::operator*() const [with _Iter = main()::s*; _Proj = std::identity;
std::indirect_result_t<_Proj&, _Iter> = main()::s&]', declared using local type
'main()::s', is used but never defined [-fpermissive]
669 | indirect_result_t<_Proj&, _Iter> operator*() const; // not
defined
|
```
# System info
OS: Ubuntu 18.04 (WSL)
Version: gcc (GCC) 10.0.1 20200320 (experimental)
Git hash:
Configured with: ../gcc/configure --disable-nls --disable-multilib
--enable-languages=c,c++ --disable-werror : (reconfigured) ../gcc/configure
--disable-nls --disable-multilib --enable-languages=c,c++ --disable-werror :
(reconfigured) ../gcc/configure --disable-nls --disable-multilib
--disable-werror CC=/usr/local/bin/gcc CFLAGS='-O3 -g0 -w'
LDFLAGS=-fuse-ld=gold CXX=/usr/local/bin/g++ CXXFLAGS='-O3 -g0 -w'
--enable-languages=c,c++,lto --no-create --no-recursion