From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19338 invoked by alias); 8 Jan 2014 13:44:51 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 19105 invoked by uid 48); 8 Jan 2014 13:44:46 -0000 From: "rafal at rawicki dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/59721] New: [4.8 Regression] std::bind nested more than one level results in infinite template substitution Date: Wed, 08 Jan 2014 13:44:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rafal at rawicki dot 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: 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: 2014-01/txt/msg00774.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D59721 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 #include struct A { struct B { struct C { C(): m(5){} int m; } c; } b; }; int main() { A::B b; auto extractor =3D std::bind(&A::B::C::m, std::bind(&A::B::c, std::placeholders::_1)); std::cout << extractor(b) << std::endl; A a; auto extractor2 =3D 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=3Dc++11 bind.cpp -o bind && ./bind 5 5 while under g++-4.8 it generates infinite template recursion: $ g++-4.8 -Wall -Wextra -std=3Dc++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=3D to increase the maximum) substituting =E2=80=98template typename std::add_rvalue_referenc= e< >::type std::declval() [with _Tp =3D A&]=E2=80=99 -> decltype(__arg(declval<_Args>()...)) ^ /usr/include/c++/4.8/functional:1391:40: recursively required by substitu= tion of =E2=80=98template decltype (__arg((declval<_Args>)()...)) std::_Mu<_Arg, true, false>::operator()(_CVA= rg&, std::tuple<_Args2 ...>&) const volatile [with _CVArg =3D _CVArg; _Args =3D = {_Args ...}; _Arg =3D std::_Bind(std::_Placeholder<1>)>] [= with _CVArg =3D const volatile std::_Bind(std::_Placeholder<1>)>; _Args =3D {A&}]=E2=80=99 /usr/include/c++/4.8/functional:1391:40: required by substitution of =E2=80=98template decltype (__arg((declval<_Args>)()...)) std::_Mu<_Arg, true, false>::__call(_CVArg&, std::tuple<_Args2 ...>&, const std::_Index_tuple<_Indexes ...>&) const volatile [with _CVArg =3D _CVArg; _= Args =3D {_Args ...}; long unsigned int ..._Indexes =3D {_Indexes ...}; _Arg =3D std::_Bind(std::_Bind(std::_Placeholder<1>)>)>] [with _CVArg =3D std::_Bind(std::_Bind(std::_Placeholder<1>)>)>; _Args= =3D {A&}; long unsigned int ..._Indexes =3D {0ul}]=E2=80=99 /usr/include/c++/4.8/functional:1143:50: template instantiation depth exc= eeds maximum of 900 (use -ftemplate-depth=3D to increase the maximum) substituti= ng =E2=80=98template typename std::add_rvalue_reference< >::type std::declval() [with _Tp =3D A&]=E2=80=99 /usr/include/c++/4.8/functional:1391:40: recursively required by substitu= tion of =E2=80=98template decltype (__arg((declval<_Args>)()...)) std::_Mu<_Arg, true, false>::operator()(_CVA= rg&, std::tuple<_Args2 ...>&) const volatile [with _CVArg =3D _CVArg; _Args =3D = {_Args ...}; _Arg =3D std::_Bind(std::_Placeholder<1>)>] [= with _CVArg =3D const volatile std::_Bind(std::_Placeholder<1>)>; _Args =3D {A&}]=E2=80=99 /usr/include/c++/4.8/functional:1391:40: required by substitution of =E2=80=98template decltype (__arg((declval<_Args>)()...)) std::_Mu<_Arg, true, false>::__call(_CVArg&, std::tuple<_Args2 ...>&, const std::_Index_tuple<_Indexes ...>&) const volatile [with _CVArg =3D _CVArg; _= Args =3D {_Args ...}; long unsigned int ..._Indexes =3D {_Indexes ...}; _Arg =3D std::_Bind(std::_Bind(std::_Placeholder<1>)>)>] [with _CVArg =3D std::_Bind(std::_Bind(std::_Placeholder<1>)>)>; _Args= =3D {A&}; long unsigned int ..._Indexes =3D {0ul}]=E2=80=99 /usr/include/c++/4.8/functional:1143:50: template instantiation depth exc= eeds maximum of 900 (use -ftemplate-depth=3D to increase the maximum) substituti= ng =E2=80=98template typename std::add_rvalue_reference< >::type std::declval() [with _Tp =3D A&]=E2=80=99 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: 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: List-Archive: List-Post: List-Help: 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" 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: In-Reply-To: References: 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?id=59722 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2014-01-08 Target Milestone|--- |4.9.0 Ever confirmed|0 |1