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

Sven Suursoho <spam+gcc at alt dot ee> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |spam+gcc at alt dot ee

--- Comment #20 from Sven Suursoho <spam+gcc at alt dot ee> ---
Seems some variant of this bug has returned with g++-11 (but not in g++-10)

$ cat s.cpp
struct S
{
    void f() noexcept {}
    S &g() noexcept(noexcept(f())) { f(); return *this; }
};

$ g++-11 -Wall -Werror -std=c++2a -c s.cpp
s.cpp:4:31: error: cannot call member function 'void S::f()' without object
    4 |     S &g() noexcept(noexcept(f())) { f(); return *this; }
      |                              ~^~


$ cat s.cpp
struct S
{
    void f() noexcept {}
    S &g() noexcept(noexcept(this->f())) { f(); return *this; }
};

$ g++-11 -Wall -Werror -std=c++2a -c s.cpp
s.cpp:4:30: error: invalid use of 'this' at top level
    4 |     S &g() noexcept(noexcept(this->f())) { f(); return *this; }
      |                              ^~~~


$ cat workaround.cpp
struct S
{
    void f() noexcept {}
    auto g() noexcept(noexcept(this->f())) -> S& { f(); return *this; }
};

$ g++-11 -Wall -Werror -std=c++2a -c workaround.cpp


$ g++-11 -v
Using built-in specs.
COLLECT_GCC=g++-11
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/11.1.0/libexec/gcc/x86_64-apple-darwin19/11.1.0/lto-wrapper
Target: x86_64-apple-darwin19
Configured with: ../configure --prefix=/usr/local/Cellar/gcc/11.1.0
--libdir=/usr/local/Cellar/gcc/11.1.0/lib/gcc/11 --disable-nls
--enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran,d
--program-suffix=-11 --with-gmp=/usr/local/opt/gmp
--with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc
--with-isl=/usr/local/opt/isl --with-pkgversion='Homebrew GCC 11.1.0'
--with-bugurl=https://github.com/Homebrew/homebrew-core/issues
--enable-libphobos --build=x86_64-apple-darwin19 --with-system-zlib
--disable-multilib --with-native-system-header-dir=/usr/include
--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.1.0 (Homebrew GCC 11.1.0)


~ $ uname -a
Darwin home.local 19.6.0 Darwin Kernel Version 19.6.0: Mon Apr 12 20:57:45 PDT
2021; root:xnu-6153.141.28.1~1/RELEASE_X86_64 x86_64

Reply via email to