public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/57898] New: std::bind incompatible with ref-qualified ptmf
@ 2013-07-15  8:26 potswa at mac dot com
  2013-07-15 10:24 ` [Bug libstdc++/57898] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: potswa at mac dot com @ 2013-07-15  8:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57898

            Bug ID: 57898
           Summary: std::bind incompatible with ref-qualified ptmf
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: potswa at mac dot com

#include <functional>

struct s { void f() &; };
s *p;

auto b = std::bind( &s::f, p );

Resulting error:

error: forming reference to qualified function type ‘void() &’

The original case produced an overload resolution failure for std::bind, with a
complaint like "no known conversion for argument 1 from void(t::*)(arg&&) to
void(t::*&&)(arg&&)", i.e. it's having trouble binding the ptmf reference.
However I have isolated that problem. It seems there may an underlying issue in
the compiler though.
>From gcc-bugs-return-426223-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jul 15 08:55:00 2013
Return-Path: <gcc-bugs-return-426223-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 23868 invoked by alias); 15 Jul 2013 08:55:00 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 19086 invoked by uid 48); 15 Jul 2013 08:52:58 -0000
From: "jpr at essi dot fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/57899] New: bind/function with data member: infinite recursion
Date: Mon, 15 Jul 2013 08:55:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jpr at essi dot fr
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-57899-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-07/txt/msg00730.txt.bz2
Content-length: 9334

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57899

            Bug ID: 57899
           Summary: bind/function with data member: infinite recursion
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jpr at essi dot fr

The following program fails to compile with gcc-4.8.1 in C++11 mode: 

#include <cassert> 
#include <string> 
#include <map>
#include <list>
#include <algorithm>
#include <functional>
using namespace std;
using namespace std::placeholders;

int main()
{
    map<string, int> table = {{"0123456789012345", 0}}; 
    //list<pair<string, int>> table = {{"0123456789012345", 0}}; 
    function<string(const pair<const string, int>&)> get_first = 
        bind(&pair<const string, int>::first, _1);

    auto it = find_if(table.begin(), table.end(),
                      bind(greater<size_t>(),
                           bind(&string::length, bind(get_first, _1)),
                           5));
    assert(it != table.end());

    return 0;
}

Here is the result of compiling:

--------------------------------------------------------------
prospero% g++ -v -save-temps -std=c++11 -Wall -g -I../include
-ftemplate-depth=10000 a.cpp 2>&1 
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/jpr/LOCAL/test/gcc-4.8.1/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/user/jpr/home/LOCAL/test/gcc-4.8.1
--with-local-prefix=/user/jpr/home/LOCAL/test/gcc-4.8.1 --enable-threads
--enable-languages=ada,c,c++,fortran,objc,obj-c++,go,java
--with-gmp-lib=/usr/lib64 --with-mpfr-lib=/usr/lib64 --with-mpc-lib=/usr/lib64
Thread model: posix
gcc version 4.8.1 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-Wall' '-g' '-I'
'../include' '-ftemplate-depth=10000' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'

/home/jpr/LOCAL/test/gcc-4.8.1/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/cc1plus
-E -quiet -v -I ../include -iprefix
/home/jpr/LOCAL/test/gcc-4.8.1/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/
-D_GNU_SOURCE a.cpp -mtune=generic -march=x86-64 -std=c++11 -Wall
-ftemplate-depth=10000 -g -fworking-directory -fpch-preprocess -o a.ii
ignoring nonexistent directory
"/home/jpr/LOCAL/test/gcc-4.8.1/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../x86_64-unknown-linux-gnu/include"
ignoring duplicate directory
"/home/jpr/LOCAL/test/gcc-4.8.1/bin/../lib/gcc/../../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1"
ignoring duplicate directory
"/home/jpr/LOCAL/test/gcc-4.8.1/bin/../lib/gcc/../../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/x86_64-unknown-linux-gnu"
ignoring duplicate directory
"/home/jpr/LOCAL/test/gcc-4.8.1/bin/../lib/gcc/../../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/backward"
ignoring duplicate directory
"/home/jpr/LOCAL/test/gcc-4.8.1/bin/../lib/gcc/../../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include"
ignoring duplicate directory
"/home/jpr/LOCAL/test/gcc-4.8.1/bin/../lib/gcc/../../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include-fixed"
ignoring nonexistent directory
"/home/jpr/LOCAL/test/gcc-4.8.1/bin/../lib/gcc/../../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 ../include

/home/jpr/LOCAL/test/gcc-4.8.1/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1

/home/jpr/LOCAL/test/gcc-4.8.1/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/x86_64-unknown-linux-gnu

/home/jpr/LOCAL/test/gcc-4.8.1/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/../../../../include/c++/4.8.1/backward

/home/jpr/LOCAL/test/gcc-4.8.1/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include

/home/jpr/LOCAL/test/gcc-4.8.1/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include-fixed
 /user/jpr/home/LOCAL/test/gcc-4.8.1/include
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-Wall' '-g' '-I'
'../include' '-ftemplate-depth=10000' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'

/home/jpr/LOCAL/test/gcc-4.8.1/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/cc1plus
-fpreprocessed a.ii -quiet -dumpbase a.cpp -mtune=generic -march=x86-64
-auxbase a -g -Wall -std=c++11 -version -ftemplate-depth=10000 -o a.s
GNU C++ (GCC) version 4.8.1 (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.8.1, GMP version 5.0.2, MPFR version 3.1.0, MPC
version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (GCC) version 4.8.1 (x86_64-unknown-linux-gnu)
    compiled by GNU C version 4.8.1, GMP version 5.0.2, MPFR version 3.1.0, MPC
version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: f1ad4865ded0b3f0e4317ac2d8456db9
In file included from
/home/jpr/LOCAL/test/gcc-4.8.1/include/c++/4.8.1/bits/stl_algo.h:66:0,
                 from
/home/jpr/LOCAL/test/gcc-4.8.1/include/c++/4.8.1/algorithm:62,
                 from a.cpp:5:
/home/jpr/LOCAL/test/gcc-4.8.1/include/c++/4.8.1/functional:1138:35: error:
template instantiation depth exceeds maximum of 10000 (use -ftemplate-depth= to
increase the maximum) substituting ‘template<class _Tp> typename
std::add_rvalue_reference< <template-parameter-1-1> >::type std::declval()
[with _Tp = std::pair<const std::basic_string<char>, int>&]’
  -> decltype(__arg(declval<_Args>()...))
                                   ^
/home/jpr/LOCAL/test/gcc-4.8.1/include/c++/4.8.1/functional:1391:40:  
recursively required by substitution of ‘template<class _CVArg, class ...
_Args> decltype (__arg((declval<_Args>)()...)) std::_Mu<_Arg, true,
false>::operator()(_CVArg&, std::tuple<_Args2 ...>&) const volatile [with
_CVArg = _CVArg; _Args = {_Args ...}; _Arg =
std::_Bind<std::function<std::basic_string<char>(const std::pair<const
std::basic_string<char>, int>&)>(std::_Placeholder<1>)>] [with _CVArg = const
volatile std::_Bind<std::function<std::basic_string<char>(const std::pair<const
std::basic_string<char>, int>&)>(std::_Placeholder<1>)>; _Args =
{std::pair<const std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, int>&}]’
/home/jpr/LOCAL/test/gcc-4.8.1/include/c++/4.8.1/functional:1391:40:   required
by substitution of ‘template<class _CVArg, class ... _Args, long unsigned int
..._Indexes> decltype (__arg((declval<_Args>)()...)) std::_Mu<_Arg, true,
false>::__call(_CVArg&, std::tuple<_Args2 ...>&, const
std::_Index_tuple<_Indexes ...>&) const volatile [with _CVArg = _CVArg; _Args =
{_Args ...}; long unsigned int ..._Indexes = {_Indexes ...}; _Arg =
std::_Bind<std::_Mem_fn<long unsigned int
(std::basic_string<char>::*)()const>(std::_Bind<std::function<std::basic_string<char>(const
std::pair<const std::basic_string<char>, int>&)>(std::_Placeholder<1>)>)>]
[with _CVArg = std::_Bind<std::_Mem_fn<long unsigned int
(std::basic_string<char>::*)()const>(std::_Bind<std::function<std::basic_string<char>(const
std::pair<const std::basic_string<char>, int>&)>(std::_Placeholder<1>)>)>;
_Args = {std::pair<const std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, int>&}; long unsigned int ..._Indexes = {0ul}]’
/home/jpr/LOCAL/test/gcc-4.8.1/include/c++/4.8.1/functional:1143:50:   template
instantiation depth exceeds maximum of 10000 (use -ftemplate-depth= to increase
the maximum) substituting ‘template<class _Tp> typename
std::add_rvalue_reference< <template-parameter-1-1> >::type std::declval()
[with _Tp = std::pair<const std::basic_string<char>, int>&]’
/home/jpr/LOCAL/test/gcc-4.8.1/include/c++/4.8.1/functional:1391:40:  
recursively required by substitution of ‘template<class _CVArg, class ...
_Args> decltype (__arg((declval<_Args>)()...)) std::_Mu<_Arg, true,
false>::operator()(_CVArg&, std::tuple<_Args2 ...>&) const volatile [with
_CVArg = _CVArg; _Args = {_Args ...}; _Arg =
std::_Bind<std::function<std::basic_string<char>(const std::pair<const
std::basic_string<char>, int>&)>(std::_Placeholder<1>)>] [with _CVArg = const
volatile std::_Bind<std::function<std::basic_string<char>(const std::pair<const
std::basic_string<char>, int>&)>(std::_Placeholder<1>)>; _Args =
{std::pair<const std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, int>&}]’

... FOLLOWED BY A LOT OF SIMILAR MESSAGES...
--------------------------------------------------------------

Note that
- I increased the -ftemplate-depth parameter to 10000; indeed, it seems to be
an infinite loop;
- replacing the map by a list (commented line) does not change anything; the
error messages are similar;
- compilation also fails with the same messages on MacOS 1.8.4 with g++-4.8.1
(MacPorts gcc48 4.8-20130404_1)
- The same program compiles (and works) correctly with g++-4.7.2 '4.7.2
20120921 (Red Hat 4.7.2-2)).

Regards

Jean-Paul Rigault
>From gcc-bugs-return-426224-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jul 15 09:32:50 2013
Return-Path: <gcc-bugs-return-426224-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 6578 invoked by alias); 15 Jul 2013 09:32:49 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 4120 invoked by uid 48); 15 Jul 2013 09:30:47 -0000
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/49138] Add /usr/include/fortran/{,gcc-<version>} to the file/module search path
Date: Mon, 15 Jul 2013 09:32:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.7.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: burnus at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-49138-4-Q9B7JvYNnx@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-49138-4@http.gcc.gnu.org/bugzilla/>
References: <bug-49138-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-07/txt/msg00731.txt.bz2
Content-length: 328

http://gcc.gnu.org/bugzilla/show_bug.cgi?idI138

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> ---
See also:
- http://fedoraproject.org/wiki/PackagingDrafts/FortranLibraries (from 2008)
- http://bugs.debian.org/cgi-bin/bugreport.cgi?bugq4730
  + http://lists.debian.org/debian-science/2013/07/msg00012.html


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

* [Bug libstdc++/57898] std::bind incompatible with ref-qualified ptmf
  2013-07-15  8:26 [Bug libstdc++/57898] New: std::bind incompatible with ref-qualified ptmf potswa at mac dot com
@ 2013-07-15 10:24 ` redi at gcc dot gnu.org
  2014-11-03  2:56 ` redi at gcc dot gnu.org
  2014-11-03  2:57 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2013-07-15 10:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57898

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-07-15
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think the problem is simply that I haven't checked in support for
ref-qualifiers to mem_fn. I have a patch in my git repo.


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

* [Bug libstdc++/57898] std::bind incompatible with ref-qualified ptmf
  2013-07-15  8:26 [Bug libstdc++/57898] New: std::bind incompatible with ref-qualified ptmf potswa at mac dot com
  2013-07-15 10:24 ` [Bug libstdc++/57898] " redi at gcc dot gnu.org
@ 2014-11-03  2:56 ` redi at gcc dot gnu.org
  2014-11-03  2:57 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2014-11-03  2:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Mon Nov  3 02:55:32 2014
New Revision: 217024

URL: https://gcc.gnu.org/viewcvs?rev=217024&root=gcc&view=rev
Log:
Add support for ref-qualified functions to std::mem_fn

    PR libstdc++/57898
    * include/std/functional (_Mem_fn_traits_base): New class template.
    (_Mem_fn_traits): New class template with specializations for every
    combination of cv-qualified and ref-qualified member function.
    (_Mem_fn_base): New class template for all pointer to member function
    types and partial specialization for pointer to member object types.
    (_Mem_fn): Inherit from _Mem_fn_base.
    * testsuite/20_util/function_objects/mem_fn/refqual.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/20_util/function_objects/mem_fn/refqual.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/std/functional


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

* [Bug libstdc++/57898] std::bind incompatible with ref-qualified ptmf
  2013-07-15  8:26 [Bug libstdc++/57898] New: std::bind incompatible with ref-qualified ptmf potswa at mac dot com
  2013-07-15 10:24 ` [Bug libstdc++/57898] " redi at gcc dot gnu.org
  2014-11-03  2:56 ` redi at gcc dot gnu.org
@ 2014-11-03  2:57 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2014-11-03  2:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |5.0

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed on trunk


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

end of thread, other threads:[~2014-11-03  2:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-15  8:26 [Bug libstdc++/57898] New: std::bind incompatible with ref-qualified ptmf potswa at mac dot com
2013-07-15 10:24 ` [Bug libstdc++/57898] " redi at gcc dot gnu.org
2014-11-03  2:56 ` redi at gcc dot gnu.org
2014-11-03  2:57 ` 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).