public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
@ 2020-05-06 15:03 db0451 at gmail dot com
  2020-05-06 15:24 ` [Bug libstdc++/94973] " redi at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: db0451 at gmail dot com @ 2020-05-06 15:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94973
           Summary: compile error when trying to use pointer-to-member
                    function as invokable projection to ranges::find()
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: db0451 at gmail dot com
  Target Milestone: ---

`range-v3` has the concept of "invocable projections", i.e. simple
transformations that can be applied as predicates to its algorithms.
Pointer-to-member-functions should be included and mean 'get the result of
calling that on the current element'. However, it seems that invoking a
pointer-to-member-function in g++ (but NOT clang++) causes the build to fail.

Given the code, compiled with `g++ -std=c++17` against `ericniebler/range-v3`
release `range-v3-0.10.0`, using `g++.exe (Rev2, Built by MSYS2 project)
9.3.0`:

```cpp
#include <range/v3/algorithm/find.hpp>
#include <vector>

auto
main() -> int
{
        struct S {
                int i{};
                auto get_i() const { return i; }
        };

        auto const ss = std::vector<S>(10);
        ranges::find(ss, 1, &S::get_i);
        return 0;
}

```

I get a spew of errors:
```none
test.cpp: In function 'int main()':
test.cpp:14:31: error: no match for call to '(const ranges::find_fn) (const
std::vector<main()::S>&, int, int (main()::S::*)() const)'
   14 |  ranges::find(ss, 1, &S::get_i);
      |                               ^
In file included from FOO/include/range-v3/range/v3/range_fwd.hpp:24,
                 from FOO/include/range-v3/range/v3/algorithm/find.hpp:18,
                 from test.cpp:1:
FOO/include/range-v3/range/v3/detail/config.hpp:618:27: note: candidate:
'template<class I, class S, class V, class P> constexpr concepts::return_t<I,
typename std::enable_if<(((input_iterator<I> && sentinel_for<S, I>) &&
indirect_relation<ranges::equal_to, typename
ranges::detail::select_projected_<P>::apply<I>, const V*>) &&
concepts::detail::CPP_true(concepts::detail::Nil{})), void>::type>
ranges::find_fn::operator()(I, S, const V&, P) const'
  618 | #define RANGES_FUNC(NAME) operator() RANGES_FUNC_CONST_ /**/
      |                           ^~~~~~~~
FOO/include/range-v3/range/v3/algorithm/find.hpp:47:24: note: in expansion of
macro 'RANGES_FUNC'
   47 |         constexpr auto RANGES_FUNC(find)(I first, S last, V const &
val, P proj = P{})
      |                        ^~~~~~~~~~~
FOO/include/range-v3/range/v3/detail/config.hpp:618:27: note:   template
argument deduction/substitution failed:
  618 | #define RANGES_FUNC(NAME) operator() RANGES_FUNC_CONST_ /**/
      |                           ^~~~~~~~
FOO/include/range-v3/range/v3/algorithm/find.hpp:47:24: note: in expansion of
macro 'RANGES_FUNC'
   47 |         constexpr auto RANGES_FUNC(find)(I first, S last, V const &
val, P proj = P{})
      |                        ^~~~~~~~~~~
In file included from FOO/include/range-v3/range/v3/iterator/access.hpp:22,
                 from FOO/include/range-v3/range/v3/iterator/concepts.hpp:30,
                 from FOO/include/range-v3/range/v3/algorithm/find.hpp:22,
                 from test.cpp:1:
FOO/include/range-v3/std/detail/associated_types.hpp: In substitution of
'template<bool B, class T> using enable_if_t = typename
ranges::detail::enable_if::apply<T> [with bool B =
ranges::readable<std::vector<main()::S> >; T = std::vector<main()::S>]':
FOO/include/range-v3/range/v3/iterator/concepts.hpp:561:19:   required by
substitution of 'template<class I> using apply =
ranges::detail::enable_if_t<(bool)(readable<I>), I> [with I =
std::vector<main()::S>]'
FOO/include/range-v3/range/v3/algorithm/find.hpp:48:15:   required by
substitution of 'template<class I, class S, class V, class P> constexpr
concepts::return_t<I, typename std::enable_if<(((input_iterator<I> &&
sentinel_for<S, I>) && indirect_relation<ranges::equal_to, typename
ranges::detail::select_projected_<P>::apply<I>, const V*>) &&
concepts::detail::CPP_true(concepts::detail::Nil{})), void>::type>
ranges::find_fn::operator()(I, S, const V&, P) const [with I =
std::vector<main()::S>; S = int; V = int (main()::S::*)() const; P =
ranges::identity]'
test.cpp:14:31:   required from here
FOO/include/range-v3/std/detail/associated_types.hpp:73:15: error: no class
template named 'apply' in 'struct ranges::detail::enable_if<false>'
   73 |         using enable_if_t = typename enable_if<B>::template apply<T>;
      |               ^~~~~~~~~~~
In file included from FOO/include/range-v3/range/v3/range_fwd.hpp:24,
                 from FOO/include/range-v3/range/v3/algorithm/find.hpp:18,
                 from test.cpp:1:
FOO/include/range-v3/range/v3/detail/config.hpp:618:27: note: candidate:
'template<class Rng, class V, class P> constexpr concepts::return_t<typename
ranges::detail::if_then<forwarding_range_<R> >::apply<decltype
(ranges::_::begin(declval<Rng&>())), ranges::dangling>, typename
std::enable_if<((input_range<Rng> && indirect_relation<ranges::equal_to,
typename ranges::detail::select_projected_<P1>::apply<decltype
(ranges::_::begin(declval<Rng&>()))>, const V*>) &&
concepts::detail::CPP_true(concepts::detail::Nil{})), void>::type>
ranges::find_fn::operator()(Rng&&, const V&, P) const'
  618 | #define RANGES_FUNC(NAME) operator() RANGES_FUNC_CONST_ /**/
      |                           ^~~~~~~~
FOO/include/range-v3/range/v3/algorithm/find.hpp:60:24: note: in expansion of
macro 'RANGES_FUNC'
   60 |         constexpr auto RANGES_FUNC(find)(Rng && rng, V const & val, P
proj = P{})
      |                        ^~~~~~~~~~~
FOO/include/range-v3/range/v3/detail/config.hpp:618:27: note:   template
argument deduction/substitution failed:
  618 | #define RANGES_FUNC(NAME) operator() RANGES_FUNC_CONST_ /**/
      |                           ^~~~~~~~
FOO/include/range-v3/range/v3/algorithm/find.hpp:60:24: note: in expansion of
macro 'RANGES_FUNC'
   60 |         constexpr auto RANGES_FUNC(find)(Rng && rng, V const & val, P
proj = P{})
      |                        ^~~~~~~~~~~
In file included from FOO/include/range-v3/range/v3/iterator/access.hpp:22,
                 from FOO/include/range-v3/range/v3/iterator/concepts.hpp:30,
                 from FOO/include/range-v3/range/v3/algorithm/find.hpp:22,
                 from test.cpp:1:
FOO/include/range-v3/std/detail/associated_types.hpp: In substitution of
'template<bool B, class T> using enable_if_t = typename
ranges::detail::enable_if::apply<T> [with bool B =
ranges::indirectly_regular_unary_invocable<int (main()::S::*)() const,
__gnu_cxx::__normal_iterator<const main()::S*, std::vector<main()::S> > >; T =
ranges::detail::projected_<__gnu_cxx::__normal_iterator<const main()::S*,
std::vector<main()::S> >, int (main()::S::*)() const>]':
FOO/include/range-v3/range/v3/iterator/concepts.hpp:552:19:   required by
substitution of 'template<class Proj> template<class I> using apply =
ranges::detail::enable_if_t<(bool)(indirectly_regular_unary_invocable<Proj,
I>), ranges::detail::projected_<I, Proj> > [with I =
__gnu_cxx::__normal_iterator<const main()::S*, std::vector<main()::S> >; Proj =
int (main()::S::*)() const]'
FOO/include/range-v3/range/v3/algorithm/find.hpp:61:15:   required by
substitution of 'template<class Rng, class V, class P> constexpr
concepts::return_t<typename ranges::detail::if_then<forwarding_range_<R>
>::apply<decltype (ranges::_::begin(declval<Rng&>())), ranges::dangling>,
typename std::enable_if<((input_range<Rng> &&
indirect_relation<ranges::equal_to, typename
ranges::detail::select_projected_<P1>::apply<decltype
(ranges::_::begin(declval<Rng&>()))>, const V*>) &&
concepts::detail::CPP_true(concepts::detail::Nil{})), void>::type>
ranges::find_fn::operator()(Rng&&, const V&, P) const [with Rng = const
std::vector<main()::S>&; V = int; P = int (main()::S::*)() const]'
test.cpp:14:31:   required from here
FOO/include/range-v3/std/detail/associated_types.hpp:73:15: error: no class
template named 'apply' in 'struct ranges::detail::enable_if<false>'
   73 |         using enable_if_t = typename enable_if<B>::template apply<T>;
      |               ^~~~~~~~~~~

shell returned 1
```

* Making the projection a lambda works but seems wasted typing.
* Referring directly to the data member works but is not possible if it should
be encapsulated behind a const getter, transformer, etc.
* `clang++` (also on MSYS2) **does** work here. So I guess this must be a bug
in `g++`.

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

* [Bug libstdc++/94973] compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
  2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
@ 2020-05-06 15:24 ` redi at gcc dot gnu.org
  2020-05-06 15:40 ` redi at gcc dot gnu.org
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-06 15:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-05-06
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Please read https://gcc.gnu.org/bugs and provide the missing information.

Why is this marked as a libstdc++ bug?

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

* [Bug libstdc++/94973] compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
  2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
  2020-05-06 15:24 ` [Bug libstdc++/94973] " redi at gcc dot gnu.org
@ 2020-05-06 15:40 ` redi at gcc dot gnu.org
  2020-05-06 15:48 ` db0451 at gmail dot com
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-06 15:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I can't reproduce this using range-v3 0.10.0 and GCC 9.3.0 on GNU/Linux, the
example compiles fine.

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

* [Bug libstdc++/94973] compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
  2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
  2020-05-06 15:24 ` [Bug libstdc++/94973] " redi at gcc dot gnu.org
  2020-05-06 15:40 ` redi at gcc dot gnu.org
@ 2020-05-06 15:48 ` db0451 at gmail dot com
  2020-05-06 15:50 ` db0451 at gmail dot com
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: db0451 at gmail dot com @ 2020-05-06 15:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from DB <db0451 at gmail dot com> ---
> Please read https://gcc.gnu.org/bugs and provide the missing information.

Fair point. Let me know if I missed anything still.

    the exact version of GCC;
g++.exe (Rev2, Built by MSYS2 project) 9.3.0

    the system type;
Windows, g++ provided by MSYS2/MinGW64 projects

    the options given when GCC was configured/built;
I didn't build it. Is there a switch that can get this for you?

    the complete command line that triggers the bug;
g++ -I /home/ME/.local/include/range-v3 -std=c++17 -Wall -Wextra -Wpedantic
test.cpp

    the compiler output (error messages, warnings, etc.);
already included.

    the preprocessed file (*.i*) that triggers the bug, generated by adding
-save-temps to the complete compilation command
I will attach this next.


> Why is this marked as a libstdc++ bug?

I chose libstdc++ because I figured it was more likely that some corner case of
std::invoke() was ultimately being hit, rather than the core compiler being at
fault. I guess not.


> I can't reproduce this using range-v3 0.10.0 and GCC 9.3.0 on GNU/Linux, the example compiles fine.

Curioser and curioser. It's fine on clang++ on Windows too. Seems a corner
case.

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

* [Bug libstdc++/94973] compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
  2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
                   ` (2 preceding siblings ...)
  2020-05-06 15:48 ` db0451 at gmail dot com
@ 2020-05-06 15:50 ` db0451 at gmail dot com
  2020-05-06 16:03 ` [Bug c++/94973] " redi at gcc dot gnu.org
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: db0451 at gmail dot com @ 2020-05-06 15:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from DB <db0451 at gmail dot com> ---
Created attachment 48470
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48470&action=edit
test.ii from --save-temps

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

* [Bug c++/94973] compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
  2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
                   ` (3 preceding siblings ...)
  2020-05-06 15:50 ` db0451 at gmail dot com
@ 2020-05-06 16:03 ` redi at gcc dot gnu.org
  2020-05-06 16:04 ` redi at gcc dot gnu.org
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-06 16:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|libstdc++                   |c++
             Status|WAITING                     |NEW
             Target|                            |*-*-mingw*
           Keywords|                            |rejects-valid

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I can reproduce it using x86_64-w64-mingw32-g++ 9.2.1

Reduced:

#include <range/v3/algorithm/find.hpp>

struct X {
  int get_i() const { return 0; }
};

static_assert( ranges::indirectly_regular_unary_invocable<int (X::*)() const,
X*> );


Th static assert fails with mingw but not with a native compiler on linux.

I'm not yet convinced this isn't a ranges-v3 bug.

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

* [Bug c++/94973] compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
  2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
                   ` (4 preceding siblings ...)
  2020-05-06 16:03 ` [Bug c++/94973] " redi at gcc dot gnu.org
@ 2020-05-06 16:04 ` redi at gcc dot gnu.org
  2020-05-06 16:16 ` redi at gcc dot gnu.org
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-06 16:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to DB from comment #3)
> I didn't build it. Is there a switch that can get this for you?

As it says on that page, "the first three of which can be obtained from the
output of gcc -v"

But I can reproduce it now anyway.

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

* [Bug c++/94973] compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
  2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
                   ` (5 preceding siblings ...)
  2020-05-06 16:04 ` redi at gcc dot gnu.org
@ 2020-05-06 16:16 ` redi at gcc dot gnu.org
  2020-05-06 16:17 ` db0451 at gmail dot com
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-06 16:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Further reduced: 

#include <range/v3/algorithm/find.hpp>

struct X { };

using F = int (X::*)() const;
using I = X*;
using R1 = ranges::invoke_result_t<F&, X&>;
static_assert( std::is_same_v<R1, int> );

This fails because R1 is int (X::)() const which is nonsense.


(In reply to DB from comment #3)
> I chose libstdc++ because I figured it was more likely that some corner case
> of std::invoke() was ultimately being hit, rather than the core compiler
> being at fault. I guess not.

std::invoke is not even used, ranges-v3 provides its own invoke.

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

* [Bug c++/94973] compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
  2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
                   ` (6 preceding siblings ...)
  2020-05-06 16:16 ` redi at gcc dot gnu.org
@ 2020-05-06 16:17 ` db0451 at gmail dot com
  2020-05-06 16:18 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: db0451 at gmail dot com @ 2020-05-06 16:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from DB <db0451 at gmail dot com> ---
> I can reproduce it using x86_64-w64-mingw32-g++ 9.2.1

Thanks again for testing!


> I'm not yet convinced this isn't a ranges-v3 bug.

I will of course defer to your expertise! It could well be caused by something
buried somewhere in range-v3's many layers of supporting code. If it can't be a
g++ bug, of course just say the word, and I will just forward this all to them.


> As it says on that page, "the first three of which can be obtained from the output of gcc -v"

D'oh. Here we are:

$ g++ -v
Using built-in specs.
COLLECT_GCC=C:\msys64\mingw64\bin\g++.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.3.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-9.3.0/configure --prefix=/mingw64
--with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32
--host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32
--with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include
--libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64
--with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++
--enable-shared --enable-static --enable-libatomic --enable-threads=posix
--enable-graphite --enable-fully-dynamic-string
--enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes
--disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check
--enable-lto --enable-libgomp --disable-multilib --enable-checking=release
--disable-rpath --disable-win32-registry --disable-nls --disable-werror
--disable-symvers --enable-plugin --with-libiconv --with-system-zlib
--with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64
--with-isl=/mingw64 --with-pkgversion='Rev2, Built by MSYS2 project'
--with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as
--with-gnu-ld
Thread model: posix
gcc version 9.3.0 (Rev2, Built by MSYS2 project)

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

* [Bug c++/94973] compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
  2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
                   ` (7 preceding siblings ...)
  2020-05-06 16:17 ` db0451 at gmail dot com
@ 2020-05-06 16:18 ` redi at gcc dot gnu.org
  2020-05-06 16:26 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-06 16:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
If it used std::invoke it would compile:

static_assert( std::is_same_v<std::invoke_result_t<F&, X&>, int> );    // OK
static_assert( std::is_same_v<ranges::invoke_result_t<F&, X&>, int> ); // ERROR

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

* [Bug c++/94973] compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
  2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
                   ` (8 preceding siblings ...)
  2020-05-06 16:18 ` redi at gcc dot gnu.org
@ 2020-05-06 16:26 ` redi at gcc dot gnu.org
  2020-05-06 16:27 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-06 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=94771

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Aha, the same problem happens on linux if I compile with -fms-extensions

This is the old MS extension that causes x.*f to be accepted when f is a
pointer to member function, which should only be valid when used as (x.*f)().

That causes ranges::invoke to think that the projection is a pointer to data
member, when actually it's a pointer to member function.

See also PR 94771 comment 4.

Jason, do we want to disable that extension in SFINAE contexts?

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

* [Bug c++/94973] compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
  2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
                   ` (9 preceding siblings ...)
  2020-05-06 16:26 ` redi at gcc dot gnu.org
@ 2020-05-06 16:27 ` redi at gcc dot gnu.org
  2020-05-06 16:30 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-06 16:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Oops, CCing Jason this time.

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

* [Bug c++/94973] compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
  2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
                   ` (10 preceding siblings ...)
  2020-05-06 16:27 ` redi at gcc dot gnu.org
@ 2020-05-06 16:30 ` redi at gcc dot gnu.org
  2020-05-06 16:32 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-06 16:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
-fno-ms-extensions will allow you to compile it, as long as you aren't relying
on any of the other MSVC compatibility quirks.

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

* [Bug c++/94973] compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
  2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
                   ` (11 preceding siblings ...)
  2020-05-06 16:30 ` redi at gcc dot gnu.org
@ 2020-05-06 16:32 ` rguenth at gcc dot gnu.org
  2020-05-06 16:39 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-06 16:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> ---
Does MSVC still accept that [without diagnostic]?  Maybe it's time to remove it
completely...

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

* [Bug c++/94973] compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
  2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
                   ` (12 preceding siblings ...)
  2020-05-06 16:32 ` rguenth at gcc dot gnu.org
@ 2020-05-06 16:39 ` redi at gcc dot gnu.org
  2020-05-06 16:42 ` db0451 at gmail dot com
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-06 16:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Jonathan Wakely <redi at gcc dot gnu.org> ---
No (see PR 94771 comment 4)

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

* [Bug c++/94973] compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
  2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
                   ` (13 preceding siblings ...)
  2020-05-06 16:39 ` redi at gcc dot gnu.org
@ 2020-05-06 16:42 ` db0451 at gmail dot com
  2020-05-06 16:46 ` db0451 at gmail dot com
  2020-05-06 16:47 ` redi at gcc dot gnu.org
  16 siblings, 0 replies; 18+ messages in thread
From: db0451 at gmail dot com @ 2020-05-06 16:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from DB <db0451 at gmail dot com> ---
Aha, many thanks for the findings.

IMO the MS extensions should really be off by default, esp if compiling in a
Standard mode, until the user actually says they want them... right? They seem
liable to lead to issues. And might explain lots of other weird warning spam I
got earlier... (All I do special is pass -mwindows, just to avoid a spurious
terminal)

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

* [Bug c++/94973] compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
  2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
                   ` (14 preceding siblings ...)
  2020-05-06 16:42 ` db0451 at gmail dot com
@ 2020-05-06 16:46 ` db0451 at gmail dot com
  2020-05-06 16:47 ` redi at gcc dot gnu.org
  16 siblings, 0 replies; 18+ messages in thread
From: db0451 at gmail dot com @ 2020-05-06 16:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from DB <db0451 at gmail dot com> ---
> -fno-ms-extensions will allow you to compile it, as long as you aren't relying on any of the other MSVC compatibility quirks.

That indeed fixes the problem, as well as squashing lots of other spurious
warnings (some of which default to errors!) from libsigc++ in the same project
that were Windows-specific. Thanks!

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

* [Bug c++/94973] compile error when trying to use pointer-to-member function as invokable projection to ranges::find()
  2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
                   ` (15 preceding siblings ...)
  2020-05-06 16:46 ` db0451 at gmail dot com
@ 2020-05-06 16:47 ` redi at gcc dot gnu.org
  16 siblings, 0 replies; 18+ messages in thread
From: redi at gcc dot gnu.org @ 2020-05-06 16:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from Jonathan Wakely <redi at gcc dot gnu.org> ---
They're on by default for mingw, for compatibility with the MS compiler (but in
this case it seems the relevant extension is ancient history).

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

end of thread, other threads:[~2020-05-06 16:47 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06 15:03 [Bug libstdc++/94973] New: compile error when trying to use pointer-to-member function as invokable projection to ranges::find() db0451 at gmail dot com
2020-05-06 15:24 ` [Bug libstdc++/94973] " redi at gcc dot gnu.org
2020-05-06 15:40 ` redi at gcc dot gnu.org
2020-05-06 15:48 ` db0451 at gmail dot com
2020-05-06 15:50 ` db0451 at gmail dot com
2020-05-06 16:03 ` [Bug c++/94973] " redi at gcc dot gnu.org
2020-05-06 16:04 ` redi at gcc dot gnu.org
2020-05-06 16:16 ` redi at gcc dot gnu.org
2020-05-06 16:17 ` db0451 at gmail dot com
2020-05-06 16:18 ` redi at gcc dot gnu.org
2020-05-06 16:26 ` redi at gcc dot gnu.org
2020-05-06 16:27 ` redi at gcc dot gnu.org
2020-05-06 16:30 ` redi at gcc dot gnu.org
2020-05-06 16:32 ` rguenth at gcc dot gnu.org
2020-05-06 16:39 ` redi at gcc dot gnu.org
2020-05-06 16:42 ` db0451 at gmail dot com
2020-05-06 16:46 ` db0451 at gmail dot com
2020-05-06 16:47 ` 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).