From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 465A93896C24; Tue, 25 May 2021 07:42:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 465A93896C24 From: "spam+gcc at alt dot ee" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.7.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: spam+gcc at alt dot ee X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: 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: Tue, 25 May 2021 07:42:20 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D52869 Sven Suursoho changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |spam+gcc at alt dot ee --- Comment #20 from Sven Suursoho --- 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=3Dc++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=3Dc++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=3Dc++2a -c workaround.cpp $ g++-11 -v Using built-in specs. COLLECT_GCC=3Dg++-11 COLLECT_LTO_WRAPPER=3D/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=3D/usr/local/Cellar/gcc/11.1.0 --libdir=3D/usr/local/Cellar/gcc/11.1.0/lib/gcc/11 --disable-nls --enable-checking=3Drelease --enable-languages=3Dc,c++,objc,obj-c++,fortran= ,d --program-suffix=3D-11 --with-gmp=3D/usr/local/opt/gmp --with-mpfr=3D/usr/local/opt/mpfr --with-mpc=3D/usr/local/opt/libmpc --with-isl=3D/usr/local/opt/isl --with-pkgversion=3D'Homebrew GCC 11.1.0' --with-bugurl=3Dhttps://github.com/Homebrew/homebrew-core/issues --enable-libphobos --build=3Dx86_64-apple-darwin19 --with-system-zlib --disable-multilib --with-native-system-header-dir=3D/usr/include --with-sysroot=3D/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=