[Bug c++/92907] noexcept does not consider "const" in member functions

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 11 20:29:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92907

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-12-11
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:

void f(const int&);
void f(int&) = delete;

struct A
{
    int i;
    void g() const noexcept(noexcept(f(i)));
};

This should compile, but is rejected:

ne.cc:7:41: error: use of deleted function ‘void f(int&)’
    7 |     void g() const noexcept(noexcept(f(i)));
      |                                         ^
ne.cc:2:6: note: declared here
    2 | void f(int&) = delete;
      |      ^



(In reply to Helmut Zeisel from comment #0)
> In addition, member variables are not found when they are declared after the
> noexcept operator.

That was PR c++/86476 and is already fixed on trunk.


More information about the Gcc-bugs mailing list