public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/59721] New: [4.8 Regression] std::bind nested more than one level results in infinite template substitution
@ 2014-01-08 13:44 rafal at rawicki dot org
2014-01-08 14:34 ` [Bug libstdc++/59721] " redi at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: rafal at rawicki dot org @ 2014-01-08 13:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59721
Bug ID: 59721
Summary: [4.8 Regression] std::bind nested more than one level
results in infinite template substitution
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: rafal at rawicki dot org
Consider following code:
#include <functional>
#include <iostream>
struct A
{
struct B
{
struct C
{
C(): m(5){}
int m;
} c;
} b;
};
int main()
{
A::B b;
auto extractor = std::bind(&A::B::C::m, std::bind(&A::B::c,
std::placeholders::_1));
std::cout << extractor(b) << std::endl;
A a;
auto extractor2 = std::bind(&A::B::C::m, std::bind(&A::B::c,
std::bind(&A::b, std::placeholders::_1)));
std::cout << extractor2(a) << std::endl;
return 0;
}
Under g++-4.7 this code compiles correctly:
$ g++-4.7 -Wall -Wextra -std=c++11 bind.cpp -o bind && ./bind
5
5
while under g++-4.8 it generates infinite template recursion:
$ g++-4.8 -Wall -Wextra -std=c++11 bind.cpp -o bind 2>&1 | head
In file included from bind.cpp:1:0:
/usr/include/c++/4.8/functional:1138:35: error: template instantiation depth
exceeds maximum of 900 (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 = A&]’
-> decltype(__arg(declval<_Args>()...))
^
/usr/include/c++/4.8/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::_Mem_fn<A::B A::*>(std::_Placeholder<1>)>] [with
_CVArg = const volatile std::_Bind<std::_Mem_fn<A::B
A::*>(std::_Placeholder<1>)>; _Args = {A&}]’
/usr/include/c++/4.8/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<A::B::C A::B::*>(std::_Bind<std::_Mem_fn<A::B
A::*>(std::_Placeholder<1>)>)>] [with _CVArg = std::_Bind<std::_Mem_fn<A::B::C
A::B::*>(std::_Bind<std::_Mem_fn<A::B A::*>(std::_Placeholder<1>)>)>; _Args =
{A&}; long unsigned int ..._Indexes = {0ul}]’
/usr/include/c++/4.8/functional:1143:50: template instantiation depth exceeds
maximum of 900 (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 = A&]’
/usr/include/c++/4.8/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::_Mem_fn<A::B A::*>(std::_Placeholder<1>)>] [with
_CVArg = const volatile std::_Bind<std::_Mem_fn<A::B
A::*>(std::_Placeholder<1>)>; _Args = {A&}]’
/usr/include/c++/4.8/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<A::B::C A::B::*>(std::_Bind<std::_Mem_fn<A::B
A::*>(std::_Placeholder<1>)>)>] [with _CVArg = std::_Bind<std::_Mem_fn<A::B::C
A::B::*>(std::_Bind<std::_Mem_fn<A::B A::*>(std::_Placeholder<1>)>)>; _Args =
{A&}; long unsigned int ..._Indexes = {0ul}]’
/usr/include/c++/4.8/functional:1143:50: template instantiation depth exceeds
maximum of 900 (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 = A&]’
My g++ is:
$ g++-4.8 --version
g++-4.8 (Ubuntu/Linaro 4.8.2-8) 4.8.2
Copyright (C) 2013 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.
>From gcc-bugs-return-439634-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Jan 08 13:46:35 2014
Return-Path: <gcc-bugs-return-439634-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 22393 invoked by alias); 8 Jan 2014 13:46:34 -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 22365 invoked by uid 48); 8 Jan 2014 13:46:31 -0000
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/59722] [4.9 Regression] Bootstrap comparison failure on i686-linux
Date: Wed, 08 Jan 2014 13:46:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: ipa
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jakub at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on target_milestone everconfirmed
Message-ID: <bug-59722-4-nWBWpBwkTH@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59722-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59722-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: 2014-01/txt/msg00776.txt.bz2
Content-length: 459
http://gcc.gnu.org/bugzilla/show_bug.cgi?idY722
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2014-01-08
Target Milestone|--- |4.9.0
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug libstdc++/59721] [4.8 Regression] std::bind nested more than one level results in infinite template substitution
2014-01-08 13:44 [Bug libstdc++/59721] New: [4.8 Regression] std::bind nested more than one level results in infinite template substitution rafal at rawicki dot org
@ 2014-01-08 14:34 ` redi at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2014-01-08 14:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59721
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
dup dup dup
*** This bug has been marked as a duplicate of bug 57899 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-08 14:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-08 13:44 [Bug libstdc++/59721] New: [4.8 Regression] std::bind nested more than one level results in infinite template substitution rafal at rawicki dot org
2014-01-08 14:34 ` [Bug libstdc++/59721] " 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).