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.

Reply via email to