[Bug c++/78301] New: noexcept() operator rejects sibling method call without object
TonyELewis at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Nov 10 20:20:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78301
Bug ID: 78301
Summary: noexcept() operator rejects sibling method call
without object
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: TonyELewis at hotmail dot com
Target Milestone: ---
This code fails to compile under g++ (including "gcc HEAD 7.0.0 201611" on
http://melpon.org/wandbox):
struct a {
void inner() const {}
void outer() const noexcept( noexcept( inner() ) ) {
inner();
}
};
with the error:
a.cpp:3:47: error: cannot call member function ‘void a::inner() const’ without
object
void outer() const noexcept( noexcept( inner() ) ) {
^
Both Clang and MSVC accept this code, presumably treating the call to inner()
in the same way to the call in the body of outer(). This seems sensible. Is
there any principled reason g++ rejects it. If not, please can g++ be altered
to handle this inline with Clang and MSVC? Many thanks.
More information about the Gcc-bugs
mailing list