public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/94241] New: ranges::find_if doesn't like data structures defined in a function
@ 2020-03-20 17:43 cjdb.ns at gmail dot com
  2020-03-20 17:45 ` [Bug libstdc++/94241] " cjdb.ns at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: cjdb.ns at gmail dot com @ 2020-03-20 17:43 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/94241] ranges::find_if doesn't like data structures defined in a function
  2020-03-20 17:43 [Bug libstdc++/94241] New: ranges::find_if doesn't like data structures defined in a function cjdb.ns at gmail dot com
@ 2020-03-20 17:45 ` cjdb.ns at gmail dot com
  2020-03-20 17:52 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: cjdb.ns at gmail dot com @ 2020-03-20 17:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94241

--- Comment #1 from Christopher Di Bella <cjdb.ns at gmail dot com> ---
Created attachment 48074
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48074&action=edit
Temp for minimal repro

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libstdc++/94241] ranges::find_if doesn't like data structures defined in a function
  2020-03-20 17:43 [Bug libstdc++/94241] New: ranges::find_if doesn't like data structures defined in a function cjdb.ns at gmail dot com
  2020-03-20 17:45 ` [Bug libstdc++/94241] " cjdb.ns at gmail dot com
@ 2020-03-20 17:52 ` pinskia at gcc dot gnu.org
  2020-03-20 17:52 ` [Bug c++/94241] " pinskia at gcc dot gnu.org
  2020-03-20 21:07 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-03-20 17:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94241

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
#include <algorithm>

int main()
{
    struct s { int m; };
    s r[] = { s{0}, s{1}, s{2}, s{3} };
    std::ranges::find_if(r, [](auto const) { return true; });
}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/94241] ranges::find_if doesn't like data structures defined in a function
  2020-03-20 17:43 [Bug libstdc++/94241] New: ranges::find_if doesn't like data structures defined in a function cjdb.ns at gmail dot com
  2020-03-20 17:45 ` [Bug libstdc++/94241] " cjdb.ns at gmail dot com
  2020-03-20 17:52 ` pinskia at gcc dot gnu.org
@ 2020-03-20 17:52 ` pinskia at gcc dot gnu.org
  2020-03-20 21:07 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-03-20 17:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94241

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
          Component|libstdc++                   |c++

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This looks like a front-end issue rather than a library issue.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/94241] ranges::find_if doesn't like data structures defined in a function
  2020-03-20 17:43 [Bug libstdc++/94241] New: ranges::find_if doesn't like data structures defined in a function cjdb.ns at gmail dot com
                   ` (2 preceding siblings ...)
  2020-03-20 17:52 ` [Bug c++/94241] " pinskia at gcc dot gnu.org
@ 2020-03-20 21:07 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2020-03-20 21:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94241

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)
> This looks like a front-end issue rather than a library issue.

Yes. I hit this when I started implementing the ranges:: algos and trying to
test them, and reported it as PR 92894.

*** This bug has been marked as a duplicate of bug 92894 ***

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-20 21:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 17:43 [Bug libstdc++/94241] New: ranges::find_if doesn't like data structures defined in a function cjdb.ns at gmail dot com
2020-03-20 17:45 ` [Bug libstdc++/94241] " cjdb.ns at gmail dot com
2020-03-20 17:52 ` pinskia at gcc dot gnu.org
2020-03-20 17:52 ` [Bug c++/94241] " pinskia at gcc dot gnu.org
2020-03-20 21:07 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).