blob: eb31fd843e6612b42776b120aacef8183f0a7a27 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// PR c++/111284
// { dg-do compile { target c++17 } }
struct S {
S () = default;
constexpr S (const S &) noexcept : s{this} {}
constexpr S & operator= (const S &) noexcept { return *this; }
constexpr bool foo () const noexcept { return s == this; }
S *s = this;
};
constexpr bool
bar (S x) noexcept
{
return x.foo ();
}
static_assert (bar (S {}), "");
static_assert ([] (S x) { return x.foo (); } (S {}), "");
|