]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/nonesuch/nonesuch.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / nonesuch / nonesuch.cc
1 // 2019-05-14 Nina Dinka Ranns <dinka.ranns@gmail.com>
2 // Copyright (C) 2019-2022 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 <type_traits>
22 // Example taken from LWG2960
23
24 using std::__nonesuch;
25 struct such {};
26 void f(const such&){};
27 void f(const std::__nonesuch&);
28
29 int main(){
30 static_assert(!std::is_default_constructible<__nonesuch>::value,
31 "__nonesuch is default constructible");
32 static_assert(!std::is_copy_constructible<__nonesuch>::value,
33 "__nonesuch is copy constructible");
34 static_assert(!std::is_assignable<__nonesuch, __nonesuch>::value,
35 "__nonesuch is assignable");
36 static_assert(!std::is_destructible<__nonesuch>::value,
37 "__nonesuch is destructible");
38 f({});
39 }