[Bug c++/91141] Can't use class members inside conditional noexcept specifier

2019-09-10 Thread brickmen75 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91141

Oleg Fatkhiev  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #1 from Oleg Fatkhiev  ---
Fixed in 10.1

[Bug c++/91141] New: Can't use class members inside conditional noexcept specifier

2019-07-11 Thread brickmen75 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91141

Bug ID: 91141
   Summary: Can't  use class members inside conditional noexcept
specifier
   Product: gcc
   Version: 9.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: brickmen75 at gmail dot com
  Target Milestone: ---

There is minimal example of code that deny to compile:

template 
class widget {
public:
void swap(widget& rhs) noexcept(noexcept(std::swap(t, rhs.t))) {
std::swap(t, rhs.t);
}
private:
T t;
};
int main() {
widget w1, w2;
w1.swap(w2);
}

Seems like gcc forbids use of class members inside conditional noexcept
specifier. Simple workaround is to use this-> along with class members.
Also godbolt example: https://godbolt.org/z/dz18YQ