public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "spam+gcc at alt dot ee" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/52869] [DR 1207] "this" not being allowed in noexcept clauses
Date: Tue, 25 May 2021 07:42:19 +0000	[thread overview]
Message-ID: <bug-52869-4-OIx9xne0TW@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-52869-4@http.gcc.gnu.org/bugzilla/>

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

  parent reply	other threads:[~2021-05-25  7:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-04 15:47 [Bug c++/52869] New: " dave at boostpro dot com
2013-09-18 17:54 ` [Bug c++/52869] [DR 1207] " redi at gcc dot gnu.org
2015-06-07  8:04 ` lz96 at foxmail dot com
2021-05-25  7:42 ` spam+gcc at alt dot ee [this message]
2021-05-25  9:02 ` redi 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-52869-4-OIx9xne0TW@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).