public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100362] New: ICE with Boost.Asio async_initiate
@ 2021-04-30 18:54 enolan at alumni dot cmu.edu
  2021-04-30 21:32 ` [Bug c++/100362] " mpolacek at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: enolan at alumni dot cmu.edu @ 2021-04-30 18:54 UTC (permalink / raw)
  To: gcc-bugs

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([&]() {});
}

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

* [Bug c++/100362] ICE with Boost.Asio async_initiate
  2021-04-30 18:54 [Bug c++/100362] New: ICE with Boost.Asio async_initiate enolan at alumni dot cmu.edu
@ 2021-04-30 21:32 ` mpolacek at gcc dot gnu.org
  2021-04-30 22:37 ` [Bug c++/100362] [11/12 Regression] " mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-30 21:32 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2021-04-30
     Ever confirmed|0                           |1
           Keywords|                            |ice-on-valid-code

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r11-6815.  Reducing...

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

* [Bug c++/100362] [11/12 Regression] ICE with Boost.Asio async_initiate
  2021-04-30 18:54 [Bug c++/100362] New: ICE with Boost.Asio async_initiate enolan at alumni dot cmu.edu
  2021-04-30 21:32 ` [Bug c++/100362] " mpolacek at gcc dot gnu.org
@ 2021-04-30 22:37 ` mpolacek at gcc dot gnu.org
  2021-05-03  7:34 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-04-30 22:37 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.2
            Summary|ICE with Boost.Asio         |[11/12 Regression] ICE with
                   |async_initiate              |Boost.Asio async_initiate
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
template <typename _Tp> struct remove_cv { using type = _Tp; };
class async_result {
public:
  template <typename Initiation, typename RawCompletionToken>
  static void initiate(Initiation initiation, RawCompletionToken token) {
    initiation(token);
  }
};
template <typename CompletionToken, typename, typename Initiation>
void async_initiate(Initiation initiation, CompletionToken token) {
  async_result::initiate(initiation, token);
}
template <typename> class allocator {};
template <typename, typename _Alloc> void allocate_shared(_Alloc) { }
template <typename _Tp> void make_shared() {
  allocate_shared<_Tp>(allocator<typename remove_cv<_Tp>::type>());
}
template <typename> class Foo {};
template <typename> class Qux {
public:
  template <typename CompletionToken>
  decltype(auto) AsyncOp(CompletionToken &&);
  int a_;
};
template <typename T>
template <typename CompletionToken>
decltype(auto) Qux<T>::AsyncOp(CompletionToken &&token) {
  using SignatureType = void;
  async_initiate<CompletionToken, SignatureType>(
      [this](auto) {
        struct Grault : Foo<decltype(a_)> {};
        auto ptr{make_shared<Grault>};
      },
      token);
}
void corge() {
  Qux<int> qux;
  qux.AsyncOp([] {});
}

$ xg++-10 -c 100362.C
$ xg++-11 -c 100362.C
100362.C: In instantiation of ‘struct Qux<int>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>::Grault’:
100362.C:16:23:   required from ‘void make_shared() [with _Tp =
Qux<int>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>::Grault]’
100362.C:32:14:   required from ‘Qux<int>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)> [with auto:1 = corge()::<lambda()>]’
100362.C:6:15:   required from ‘static void async_result::initiate(Initiation,
RawCompletionToken) [with Initiation = Qux<int>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>; RawCompletionToken =
corge()::<lambda()>]’
100362.C:11:25:   required from ‘void async_initiate(Initiation,
CompletionToken) [with CompletionToken = corge()::<lambda()>;
<template-parameter-1-2> = void; Initiation =
Qux<int>::AsyncOp<corge()::<lambda()>
>(corge()::<lambda()>&&)::<lambda(auto:1)>]’
100362.C:29:49:   required from ‘decltype(auto) Qux< <template-parameter-1-1>
>::AsyncOp(CompletionToken&&) [with CompletionToken = corge()::<lambda()>;
<template-parameter-1-1> = int]’
100362.C:38:14:   required from here
100362.C:30:18: internal compiler error: in lookup_template_class_1, at
cp/pt.c:10005
   30 |       [this](auto) {
      |                  ^
0xd154c5 lookup_template_class_1
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:10005
0xd16c95 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:10244
0xd2585c tsubst_aggr_type
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:13639
0xd3227f tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:15578
0xd3221f tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:15569
0xd2d9d6 tsubst_decl
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:14583
0xd36633 tsubst_copy
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:16661
0xd4eeef tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:20821
0xd492ec tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:19719
0xd4774c tsubst_non_call_postfix_expression
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:19292
0xd4daed tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:20601
0xd4711f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:19198
0xd2f8c2 tsubst_decl
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:14933
0xd37939 tsubst_copy
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:16796
0xd4eeef tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:20821
0xd492ec tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:19719
0xd4774c tsubst_non_call_postfix_expression
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:19292
0xd4daed tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:20601
0xd34dbb tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:16223
0xd2036e tsubst_template_arg(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc11/gcc/cp/pt.c:12300

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

* [Bug c++/100362] [11/12 Regression] ICE with Boost.Asio async_initiate
  2021-04-30 18:54 [Bug c++/100362] New: ICE with Boost.Asio async_initiate enolan at alumni dot cmu.edu
  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
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-03  7:34 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug c++/100362] [11/12 Regression] ICE with Boost.Asio async_initiate
  2021-04-30 18:54 [Bug c++/100362] New: ICE with Boost.Asio async_initiate enolan at alumni dot cmu.edu
                   ` (2 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-05-03 14:32 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Further reduced:

template <class>
struct Qux {
  struct A { } a_;

  void AsyncOp() {
    [this](auto) {
      decltype(a_) x;
      struct Grault : decltype(a_) {};
      Grault ptr;
    }(0);
  }
};

void corge() {
  Qux<int> qux;
  qux.AsyncOp();
}

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

* [Bug c++/100362] [11/12 Regression] ICE with Boost.Asio async_initiate
  2021-04-30 18:54 [Bug c++/100362] New: ICE with Boost.Asio async_initiate enolan at alumni dot cmu.edu
                   ` (3 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-05-03 15:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
If we remove the unneeded 'this' capture, then it's a rejects-valid bug:

template <class>
struct Qux {
  struct A { } a_;

  void AsyncOp() {
    [](auto) {
      struct Grault : decltype(a_) {};
      Grault ptr;
    }(0);
  }
};

void corge() {
  Qux<int> qux;
  qux.AsyncOp();
}

<stdin>: In instantiation of ‘struct
Qux<int>::AsyncOp()::<lambda(auto:1)>::Grault’:
<stdin>:11:14:   required from ‘Qux<int>::AsyncOp()::<lambda(auto:1)> [with
auto:1 = int]’
<stdin>:12:6:   required from ‘void Qux< <template-parameter-1-1> >::AsyncOp()
[with <template-parameter-1-1> = int]’
<stdin>:18:14:   required from here
<stdin>:10:32: error: invalid use of non-static data member ‘Qux<int>::a_’
<stdin>:10:32: error: ‘Qux<int>::A Qux<int>::a_’ is inaccessible within this
context
<stdin>:6:16: note: declared here

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

* [Bug c++/100362] [11/12 Regression] ICE with Boost.Asio async_initiate
  2021-04-30 18:54 [Bug c++/100362] New: ICE with Boost.Asio async_initiate enolan at alumni dot cmu.edu
                   ` (4 preceding siblings ...)
  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
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-03 17:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:2a6fc19e655e696bf0df9b7aaedf9848b23f07f3

commit r12-392-g2a6fc19e655e696bf0df9b7aaedf9848b23f07f3
Author: Patrick Palka <ppalka@redhat.com>
Date:   Mon May 3 13:35:37 2021 -0400

    c++: base-clause parsing and implicit 'this' [PR100362]

    My r11-6815 change to defer access checking when processing a
    base-clause removed a pair of pushclass / popclass calls that seemed to
    be unnecessary now that we'd also defer access checking while parsing
    the base-clause.

    But it turns out these calls make a difference in the below testcase,
    where we have a local class whose base-clause implicitly uses the 'this'
    of the enclosing class.  Before r11-6815, while parsing the base-clause
    of the local class, maybe_resolve_dummy would fail to resolve the dummy
    'this' object because the current scope would be the local class.  Now,
    since the current scope is the lambda, maybe_resolve_dummy succeeds and
    returns the 'this' for the enclosing class Qux.  Later, during deferred
    instantiation of the local class, we get confused trying to resolve the
    access of 'a_' through this non-dummy 'this'.

    So this patch just reinstates the calls to pushclass / popclass that
    were removed in r11-6815.

    gcc/cp/ChangeLog:

            PR c++/100362
            * parser.c (cp_parser_class_head): Reinstate calls to pushclass
            and popclass when parsing the base-clause that were removed in
            r11-6815.

    gcc/testsuite/ChangeLog:

            PR c++/100362
            * g++.dg/cpp1y/lambda-generic-100362.C: New test.

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

* [Bug c++/100362] [11/12 Regression] ICE with Boost.Asio async_initiate
  2021-04-30 18:54 [Bug c++/100362] New: ICE with Boost.Asio async_initiate enolan at alumni dot cmu.edu
                   ` (5 preceding siblings ...)
  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
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-03 19:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:a32b7d03210f1763a5ccd017181ad88bd95b07d1

commit r11-8344-ga32b7d03210f1763a5ccd017181ad88bd95b07d1
Author: Patrick Palka <ppalka@redhat.com>
Date:   Mon May 3 13:35:37 2021 -0400

    c++: base-clause parsing and implicit 'this' [PR100362]

    My r11-6815 change to defer access checking when processing a
    base-clause removed a pair of pushclass / popclass calls that seemed to
    be unnecessary now that we'd also defer access checking while parsing
    the base-clause.

    But it turns out these calls make a difference in the below testcase,
    where we have a local class whose base-clause implicitly uses the 'this'
    of the enclosing class.  Before r11-6815, while parsing the base-clause
    of the local class, maybe_resolve_dummy would fail to resolve the dummy
    'this' object because the current scope would be the local class.  Now,
    since the current scope is the lambda, maybe_resolve_dummy succeeds and
    returns the 'this' for the enclosing class Qux.  Later, during deferred
    instantiation of the local class, we get confused trying to resolve the
    access of 'a_' through this non-dummy 'this'.

    So this patch just reinstates the calls to pushclass / popclass that
    were removed in r11-6815.

    gcc/cp/ChangeLog:

            PR c++/100362
            * parser.c (cp_parser_class_head): Reinstate calls to pushclass
            and popclass when parsing the base-clause that were removed in
            r11-6815.

    gcc/testsuite/ChangeLog:

            PR c++/100362
            * g++.dg/cpp1y/lambda-generic-100362.C: New test.

    (cherry picked from commit 2a6fc19e655e696bf0df9b7aaedf9848b23f07f3)

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

* [Bug c++/100362] [11/12 Regression] ICE with Boost.Asio async_initiate
  2021-04-30 18:54 [Bug c++/100362] New: ICE with Boost.Asio async_initiate enolan at alumni dot cmu.edu
                   ` (6 preceding siblings ...)
  2021-05-03 19:15 ` cvs-commit at gcc dot gnu.org
@ 2021-05-03 19:16 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-05-03 19:16 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11.2 and 12.

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

end of thread, other threads:[~2021-05-03 19:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-30 18:54 [Bug c++/100362] New: ICE with Boost.Asio async_initiate enolan at alumni dot cmu.edu
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

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).