1 // Copyright (C) 2018-2021 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // { dg-options "-std=gnu++17" }
19 // { dg-do compile { target c++17 } }
23 struct NonTrivialDtor
{
27 struct NonTrivialCopyAssign
{
28 NonTrivialCopyAssign
& operator=(const NonTrivialCopyAssign
&) { return *this; }
29 NonTrivialCopyAssign
& operator=(NonTrivialCopyAssign
&&) = default;
32 struct NonTrivialMoveAssign
{
33 NonTrivialMoveAssign
& operator=(const NonTrivialMoveAssign
&) = default;
34 NonTrivialMoveAssign
& operator=(NonTrivialMoveAssign
&&) { return *this; }
37 struct NonTrivialAssign
{
38 NonTrivialAssign
& operator=(const NonTrivialAssign
&) { return *this; }
39 NonTrivialAssign
& operator=(NonTrivialAssign
&&) { return *this; }
42 struct NonTrivialAll
{
44 NonTrivialAll
& operator=(const NonTrivialAll
&) { return *this; }
45 NonTrivialAll
& operator=(NonTrivialAll
&&) { return *this; }
48 struct ConstExpr
{ int i
= 0; };
50 struct Trivial
{ int i
; };
54 = std::is_nothrow_default_constructible_v
<std::optional
<T
>>;
57 static_assert(check
<NonTrivialDtor
>);
58 static_assert(check
<NonTrivialCopyAssign
>);
59 static_assert(check
<NonTrivialMoveAssign
>);
60 static_assert(check
<NonTrivialAssign
>);
61 static_assert(check
<NonTrivialAll
>);
62 static_assert(check
<ConstExpr
>);
63 static_assert(check
<Trivial
>);