public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52869] New: "this" not being allowed in noexcept clauses
@ 2012-04-04 15:47 dave at boostpro dot com
2013-09-18 17:54 ` [Bug c++/52869] [DR 1207] " redi at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: dave at boostpro dot com @ 2012-04-04 15:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52869
Bug #: 52869
Summary: "this" not being allowed in noexcept clauses
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: dave@boostpro.com
Given the following, GCC says: "error: invalid use of 'this' at top level"
However, according to [expr.prim.general]/3 'this'
should be valid in the exception-specification as it comes after the
member function's optional cv-qualifier-seq.
#define RETURNS(...) noexcept(noexcept(__VA_ARGS__)) -> decltype(__VA_ARGS__)
{ return (__VA_ARGS__); }
struct mul_ {
int operator()() const { return 1; }
template <typename A>
A operator()(A const & a) const noexcept(A(std::move(a))) { return a; }
template <typename A, typename B, typename... C>
auto operator()(A const & a, B const & b, C const &... c) const
RETURNS((*this)(a * b, c...))
};
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/52869] [DR 1207] "this" not being allowed in noexcept clauses
2012-04-04 15:47 [Bug c++/52869] New: "this" not being allowed in noexcept clauses dave at boostpro dot com
@ 2013-09-18 17:54 ` redi at gcc dot gnu.org
2015-06-07 8:04 ` lz96 at foxmail dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2013-09-18 17:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52869
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-09-18
Summary|"this" not being allowed in |[DR 1207] "this" not being
|noexcept clauses |allowed in noexcept clauses
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/52869] [DR 1207] "this" not being allowed in noexcept clauses
2012-04-04 15:47 [Bug c++/52869] New: "this" not being allowed in noexcept clauses 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
2021-05-25 9:02 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: lz96 at foxmail dot com @ 2015-06-07 8:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52869
--- Comment #1 from htfy96 <lz96 at foxmail dot com> ---
#include <iostream>
using namespace std;
class A
{
public:
void g() noexcept(false) {}
void f() noexcept( noexcept( g() )) {};
};
A a;
int main()
{
cout<<noexcept(a.f())<<endl;
return 0;
}
This is another testcase.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/52869] [DR 1207] "this" not being allowed in noexcept clauses
2012-04-04 15:47 [Bug c++/52869] New: "this" not being allowed in noexcept clauses 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
2021-05-25 9:02 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: spam+gcc at alt dot ee @ 2021-05-25 7:42 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/52869] [DR 1207] "this" not being allowed in noexcept clauses
2012-04-04 15:47 [Bug c++/52869] New: "this" not being allowed in noexcept clauses dave at boostpro dot com
` (2 preceding siblings ...)
2021-05-25 7:42 ` spam+gcc at alt dot ee
@ 2021-05-25 9:02 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2021-05-25 9:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52869
--- Comment #21 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Oh dear. It started to fail with r11-289. I've created Bug 100752.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-05-25 9:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-04 15:47 [Bug c++/52869] New: "this" not being allowed in noexcept clauses 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
2021-05-25 9:02 ` redi 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).