Debian Codegraph @

libstdc++-v3/testsuite/experimental/type_traits/nonesuch.cc

raw
1 // 2019-05-14 Nina Dinka Ranns <[email protected]>
2 // Copyright (C) 2019-2025 Free Software Foundation, Inc.
3 //
4 // This file is part of the GNU ISO C++ Library. This library is free
5 // software; you can redistribute it and/or modify it under the
6 // terms of the GNU General Public License as published by the
7 // Free Software Foundation; either version 3, or (at your option)
8 // any later version.
9
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14
15 // You should have received a copy of the GNU General Public License along
16 // with this library; see the file COPYING3. If not see
17 // <http://www.gnu.org/licenses/>.
18
19 // { dg-do compile { target c++14 } }
20
21 #include <experimental/type_traits>
22 // Example taken from LWG2960
23
24 using std::experimental::nonesuch;
25
26 struct such {};
27 void f(const such&){};
28 void f(const nonesuch&);
29
30 int main(){
31 static_assert(!std::is_default_constructible<nonesuch>::value,
32 "nonesuch is default constructible");
33 static_assert(!std::is_copy_constructible<nonesuch>::value,
34 "nonesuch is copy constructible");
35 static_assert(!std::is_assignable<nonesuch,nonesuch>::value,
36 "nonesuch is assignable");
37 static_assert(!std::is_destructible<nonesuch>::value,
38 "nonesuch is destructible");
39 f({});
40 }