1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // UNSUPPORTED: c++98, c++03, c++11, c++14
14 // void reset() noexcept;
17 #include <type_traits>
24 static bool dtor_called;
25 ~X() {dtor_called = true;}
28 bool X::dtor_called = false;
34 static_assert(noexcept(opt.reset()) == true, "");
36 assert(static_cast<bool>(opt) == false);
41 assert(static_cast<bool>(opt) == false);
45 static_assert(noexcept(opt.reset()) == true, "");
46 assert(X::dtor_called == false);
48 assert(X::dtor_called == false);
49 assert(static_cast<bool>(opt) == false);
51 assert(X::dtor_called == false); // TRANSITION, Clang/C2 VSO#239997
54 X::dtor_called = false;
56 assert(X::dtor_called == true);
57 assert(static_cast<bool>(opt) == false);
58 X::dtor_called = false;
60 assert(X::dtor_called == false); // TRANSITION, Clang/C2 VSO#239997