public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "enolan at alumni dot cmu.edu" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-100362-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            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=50721&action=edit
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='Ubuntu
11-20210417-1ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-11
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--enable-libphobos-checking=release --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-11-pzZXCn/gcc-11-11-20210417/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-pzZXCn/gcc-11-11-20210417/debian/tmp-gcn/usr
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
--with-build-config=bootstrap-lto-lean --enable-link-serialization=2

> the complete command line that triggers the bug

g++ -I$HOME/boost_1_76_0/ -std=c++17 -save-temps -c ./ice.cpp

> the compiler output (error messages, warnings, etc.)

./ice.cpp: In instantiation of 'struct
Qux<corge()::Quux>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>::Grault':
/usr/include/c++/11/bits/shared_ptr_base.h:1358:63:   required by substitution
of 'template<class _Yp> struct
std::__shared_ptr<Qux<corge()::Quux>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>::Grault,
__gnu_cxx::_S_atomic>::__has_esft_base<_Yp, std::__void_t<decltype
(__enable_shared_from_this_base(declval<const
std::__shared_count<__gnu_cxx::_S_atomic>&>(), declval<_Yp*>()))> > [with _Yp =
Qux<corge()::Quux>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>::Grault]'
/usr/include/c++/11/bits/shared_ptr_base.h:1380:45:   required by substitution
of 'template<class _Yp, class _Yp2> typename std::enable_if<(!
std::__shared_ptr<Qux<corge()::Quux>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>::Grault,
__gnu_cxx::_S_atomic>::__has_esft_base<_Yp2, void>::value), void>::type
std::__shared_ptr<Qux<corge()::Quux>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>::Grault,
__gnu_cxx::_S_atomic>::_M_enable_shared_from_this_with<_Yp, _Yp2>(_Yp*) [with
_Yp = Qux<corge()::Quux>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>::Grault; _Yp2 =
Qux<corge()::Quux>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>::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 =
std::allocator<Qux<corge()::Quux>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>::Grault>; _Args = {}; _Tp =
Qux<corge()::Quux>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>::Grault; __gnu_cxx::_Lock_policy _Lp
= __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 = std::allocator<Qux<corge()::Quux>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>::Grault>; _Args = {}; _Tp =
Qux<corge()::Quux>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>::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 = Qux<corge()::Quux>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>::Grault; _Alloc =
std::allocator<Qux<corge()::Quux>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>::Grault>; _Args = {}]'
/usr/include/c++/11/bits/shared_ptr.h:876:39:   required from
'std::shared_ptr<_Tp> std::make_shared(_Args&& ...) [with _Tp =
Qux<corge()::Quux>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>::Grault; _Args = {}]'
./ice.cpp:24:42:   required from
'Qux<corge()::Quux>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)> [with auto:1 = corge()::<lambda()>]'
/home/enolan/boost_1_76_0/boost/asio/async_result.hpp:152:42:   required from
'static boost::asio::async_result<CompletionToken, Signature>::return_type
boost::asio::async_result<CompletionToken, Signature>::initiate(Initiation&&,
RawCompletionToken&&, Args&& ...) [with Initiation =
Qux<corge()::Quux>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>; RawCompletionToken =
corge()::<lambda()>; Args = {}; CompletionToken = corge()::<lambda()>;
Signature = void(); boost::asio::async_result<CompletionToken,
Signature>::return_type = void]'
/home/enolan/boost_1_76_0/boost/asio/async_result.hpp:365:25:   required from
'typename
boost::asio::constraint<boost::asio::detail::async_result_has_initiate_memfn<CompletionToken,
Signature>::value, decltype (boost::asio::async_result<typename
std::decay<CompletionToken>::type,
Signature>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(),
(declval<Args&&>)()...))>::type boost::asio::async_initiate(Initiation&&,
CompletionToken&, Args&& ...) [with CompletionToken = corge()::<lambda()>;
Signature = void(); Initiation =
Qux<corge()::Quux>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>; Args = {}; typename
boost::asio::constraint<boost::asio::detail::async_result_has_initiate_memfn<CompletionToken,
Signature>::value, decltype (boost::asio::async_result<typename
std::decay<CompletionToken>::type,
Signature>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(),
(declval<Args&&>)()...))>::type = void; decltype
(boost::asio::async_result<typename std::decay<CompletionToken>::type,
Signature>::initiate(declval<Initiation&&>(), declval<CompletionToken&&>(),
(declval<Args&&>)()...)) = void; typename std::decay<CompletionToken>::type =
std::decay<corge()::<lambda()> >::type]'
./ice.cpp:19:69:   required from 'decltype(auto)
Qux<T>::AsyncOp(CompletionToken&&) [with CompletionToken = corge()::<lambda()>;
T = 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_node*,
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*, bool,
bool)
        ../../src/gcc/cp/pt.c:20815
0x10edafd tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
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*, bool,
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*, bool,
bool)
        ../../src/gcc/cp/pt.c:20815
0x10edafd tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
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*, bool,
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 <file:///usr/share/doc/gcc-11/README.Bugs> 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 <boost/asio/async_result.hpp>
#include <memory>

template<typename T>
class Foo {
};
template <typename T>
class Qux {
public:
  template <typename CompletionToken>
  decltype(auto) AsyncOp(CompletionToken&&);
  T a_;
};
template <typename T>
template <typename CompletionToken>
decltype(auto) Qux<T>::AsyncOp(
    CompletionToken&& token) {
  using SignatureType = void();
  return boost::asio::async_initiate<CompletionToken, SignatureType>(
      [&, this](auto handler)
      {
        struct Grault : public Foo<decltype(a_)> {};
        auto ptr{std::make_shared<Grault>()};
      }, token);
}
void corge() {
  struct Quux {};
  Qux<Quux> qux{Quux{}};
  qux.AsyncOp([&]() {});
}

             reply	other threads:[~2021-04-30 18:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-30 18:54 enolan at alumni dot cmu.edu [this message]
2021-04-30 21:32 ` [Bug c++/100362] " mpolacek at gcc dot gnu.org
2021-04-30 22:37 ` [Bug c++/100362] [11/12 Regression] " mpolacek at gcc dot gnu.org
2021-05-03  7:34 ` rguenth at gcc dot gnu.org
2021-05-03 14:32 ` ppalka at gcc dot gnu.org
2021-05-03 15:44 ` ppalka at gcc dot gnu.org
2021-05-03 17:36 ` cvs-commit at gcc dot gnu.org
2021-05-03 19:15 ` cvs-commit at gcc dot gnu.org
2021-05-03 19:16 ` ppalka at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-100362-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).