From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 624C73857811; Fri, 30 Apr 2021 18:54:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 624C73857811 From: "enolan at alumni dot cmu.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100362] New: ICE with Boost.Asio async_initiate Date: Fri, 30 Apr 2021 18:54:30 +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: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: enolan at alumni dot cmu.edu X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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 target_milestone attachments.created 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-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Apr 2021 18:54:30 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100362 Bug ID: 100362 Summary: ICE with Boost.Asio async_initiate Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: enolan at alumni dot cmu.edu Target Milestone: --- Created attachment 50721 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D50721&action=3Dedit Preprocessed file that triggers the bug. > the exact version of GCC gcc version 11.0.1 20210417 (experimental) [master revision c1c86ab96c2:b6fb0ccbb48:8ae884c09fbba91e9cec391290ee4a2859e7ff41] (Ubuntu 11-20210417-1ubuntu1) > the system type Ubuntu 21.04 > the options given when GCC was configured/built Configured with: ../src/configure -v --with-pkgversion=3D'Ubuntu 11-20210417-1ubuntu1' --with-bugurl=3Dfile:///usr/share/doc/gcc-11/README.B= ugs --enable-languages=3Dc,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix= =3D/usr --with-gcc-major-version-only --program-suffix=3D-11 --program-prefix=3Dx86_64-linux-gnu- --enable-shared --enable-linker-build-= id --libexecdir=3D/usr/lib --without-included-gettext --enable-threads=3Dposix --libdir=3D/usr/lib --enable-nls --enable-bootstrap --enable-clocale=3Dgnu --enable-libstdcxx-debug --enable-libstdcxx-time=3Dyes --with-default-libstdcxx-abi=3Dnew --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-= zlib --enable-libphobos-checking=3Drelease --with-target-system-zlib=3Dauto --enable-objc-gc=3Dauto --enable-multiarch --disable-werror --enable-cet --with-arch-32=3Di686 --with-abi=3Dm64 --with-multilib-list=3Dm32,m64,mx32 --enable-multilib --with-tune=3Dgeneric --enable-offload-targets=3Dnvptx-none=3D/build/gcc-11-pzZXCn/gcc-11-11-2021= 0417/debian/tmp-nvptx/usr,amdgcn-amdhsa=3D/build/gcc-11-pzZXCn/gcc-11-11-20= 210417/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=3Drelease --build=3Dx86_64-linux-gnu --host=3Dx86_64-linux-gnu --target=3Dx86_64-linux-gnu --with-build-config=3Dbootstrap-lto-lean --enable-link-serialization=3D2 > the complete command line that triggers the bug g++ -I$HOME/boost_1_76_0/ -std=3Dc++17 -save-temps -c ./ice.cpp > the compiler output (error messages, warnings, etc.) ./ice.cpp: In instantiation of 'struct Qux::AsyncOp >(corge()::&&)::::Grault': /usr/include/c++/11/bits/shared_ptr_base.h:1358:63: required by substitut= ion of 'template struct std::__shared_ptr::AsyncOp >(corge()::&&)::::Grault, __gnu_cxx::_S_atomic>::__has_esft_base<_Yp, std::__void_t&>(), declval<_Yp*>()))> > [with _= Yp =3D Qux::AsyncOp >(corge()::&&)::::Grault]' /usr/include/c++/11/bits/shared_ptr_base.h:1380:45: required by substitut= ion of 'template typename std::enable_if<(! std::__shared_ptr::AsyncOp >(corge()::&&)::::Grault, __gnu_cxx::_S_atomic>::__has_esft_base<_Yp2, void>::value), void>::type std::__shared_ptr::AsyncOp >(corge()::&&)::::Grault, __gnu_cxx::_S_atomic>::_M_enable_shared_from_this_with<_Yp, _Yp2>(_Yp*) [wi= th _Yp =3D Qux::AsyncOp >(corge()::&&)::::Grault; _Yp2 =3D Qux::AsyncOp >(corge()::&&)::::Grault]' /usr/include/c++/11/bits/shared_ptr_base.h:1338:35: required from 'std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc =3D std::allocator::AsyncOp >(corge()::&&)::::Grault>; _Args =3D {}; _Tp =3D Qux::AsyncOp >(corge()::&&)::::Grault; __gnu_cxx::_Lock_policy= _Lp =3D __gnu_cxx::_S_atomic]' /usr/include/c++/11/bits/shared_ptr.h:409:59: required from 'std::shared_ptr<_Tp>::shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& .= ..) [with _Alloc =3D std::allocator::AsyncOp >(corge()::&&)::::Grault>; _Args =3D {}; _Tp =3D Qux::AsyncOp >(corge()::&&)::::Grault]' /usr/include/c++/11/bits/shared_ptr.h:860:14: required from 'std::shared_ptr<_Tp> std::allocate_shared(const _Alloc&, _Args&& ...) [with _Tp =3D Qux::AsyncOp >(corge()::&&)::::Grault; _Alloc =3D std::allocator::AsyncOp >(corge()::&&)::::Grault>; _Args =3D {}]' /usr/include/c++/11/bits/shared_ptr.h:876:39: required from 'std::shared_ptr<_Tp> std::make_shared(_Args&& ...) [with _Tp =3D Qux::AsyncOp >(corge()::&&)::::Grault; _Args =3D {}]' ./ice.cpp:24:42: required from 'Qux::AsyncOp >(corge()::&&):: [with auto:1 =3D corge()::]' /home/enolan/boost_1_76_0/boost/asio/async_result.hpp:152:42: required fr= om 'static boost::asio::async_result::return_type boost::asio::async_result::initiate(Initiation&= &, RawCompletionToken&&, Args&& ...) [with Initiation =3D Qux::AsyncOp >(corge()::&&)::; RawCompletionToken =3D corge()::; Args =3D {}; CompletionToken =3D corge()::; Signature =3D void(); boost::asio::async_result::return_type =3D void]' /home/enolan/boost_1_76_0/boost/asio/async_result.hpp:365:25: required fr= om 'typename boost::asio::constraint::value, decltype (boost::asio::async_result::type, Signature>::initiate(declval(), declval(), (declval)()...))>::type boost::asio::async_initiate(Initiation&&, CompletionToken&, Args&& ...) [with CompletionToken =3D corge()::; Signature =3D void(); Initiation =3D Qux::AsyncOp >(corge()::&&)::; Args =3D {}; typename boost::asio::constraint::value, decltype (boost::asio::async_result::type, Signature>::initiate(declval(), declval(), (declval)()...))>::type =3D void; decltype (boost::asio::async_result::type, Signature>::initiate(declval(), declval(), (declval)()...)) =3D void; typename std::decay::ty= pe =3D std::decay >::type]' ./ice.cpp:19:69: required from 'decltype(auto) Qux::AsyncOp(CompletionToken&&) [with CompletionToken =3D corge()::; T =3D corge()::Quux]' ./ice.cpp:30:14: required from here ./ice.cpp:20:29: internal compiler error: in lookup_template_class_1, at cp/pt.c:10005 20 | [&, this](auto handler) | ^ 0x704ee6 lookup_template_class_1 ../../src/gcc/cp/pt.c:10005 0x10c28d6 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_no= de*, int, int) ../../src/gcc/cp/pt.c:10244 0x10c28d6 tsubst_aggr_type ../../src/gcc/cp/pt.c:13639 0x10b5906 tsubst(tree_node*, tree_node*, int, tree_node*) ../../src/gcc/cp/pt.c:15569 0x11761e8 tsubst_decl ../../src/gcc/cp/pt.c:14583 0x10f219f tsubst_copy ../../src/gcc/cp/pt.c:16661 0x10ed5ac tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bo= ol, bool) ../../src/gcc/cp/pt.c:20815 0x10edafd tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bo= ol, bool) ../../src/gcc/cp/pt.c:19719 0x10ed9c7 tsubst_non_call_postfix_expression ../../src/gcc/cp/pt.c:19292 0x10ed9c7 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bo= ol, bool) ../../src/gcc/cp/pt.c:20595 0x11781f7 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../src/gcc/cp/pt.c:19198 0x117690e tsubst_decl ../../src/gcc/cp/pt.c:14933 0x724d15 tsubst_copy ../../src/gcc/cp/pt.c:16796 0x10ed5ac tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bo= ol, bool) ../../src/gcc/cp/pt.c:20815 0x10edafd tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bo= ol, bool) ../../src/gcc/cp/pt.c:19719 0x10ed9c7 tsubst_non_call_postfix_expression ../../src/gcc/cp/pt.c:19292 0x10ed9c7 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bo= ol, bool) ../../src/gcc/cp/pt.c:20595 0x10b5e4b tsubst(tree_node*, tree_node*, int, tree_node*) ../../src/gcc/cp/pt.c:16223 0x10c2ba4 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*) ../../src/gcc/cp/pt.c:12300 0x10c2ba4 tsubst_template_args(tree_node*, tree_node*, int, tree_node*) ../../src/gcc/cp/pt.c:13418 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See for instructions. > the preprocessed file (*.i*) that triggers the bug, generated by adding -= save-temps to the complete compilation command, or, in the case of a bug report for= the GNAT front end, a complete set of source files (see below). See attachment. Additionally, here are the contents of the .cpp file I used to trigger this issue. The included file is from Boost 1.76.0. #include #include template class Foo { }; template class Qux { public: template decltype(auto) AsyncOp(CompletionToken&&); T a_; }; template template decltype(auto) Qux::AsyncOp( CompletionToken&& token) { using SignatureType =3D void(); return boost::asio::async_initiate( [&, this](auto handler) { struct Grault : public Foo {}; auto ptr{std::make_shared()}; }, token); } void corge() { struct Quux {}; Qux qux{Quux{}}; qux.AsyncOp([&]() {}); }=