Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / utilities / optional / optional.object / optional_requires_destructible_object.verify.cpp
bloba96c3c648f939f902fe08e953947e288aa1185d4
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
10 // <optional>
12 // T shall be an object type and shall satisfy the requirements of Destructible
14 #include <optional>
16 using std::optional;
18 struct X
20 private:
21 ~X() {}
24 int main(int, char**)
26 using std::optional;
28 // expected-error-re@optional:* 2 {{static assertion failed{{.*}}instantiation of optional with a reference type is ill-formed}}
29 optional<int&> opt1;
30 optional<int&&> opt2;
33 // expected-error-re@optional:* {{static assertion failed{{.*}}instantiation of optional with a non-destructible type is ill-formed}}
34 optional<X> opt3;
37 // expected-error-re@optional:* {{static assertion failed{{.*}}instantiation of optional with a non-object type is undefined behavior}}
38 // expected-error-re@optional:* {{static assertion failed{{.*}}instantiation of optional with a non-destructible type is ill-formed}}
39 optional<void()> opt4;
42 // expected-error-re@optional:* {{static assertion failed{{.*}}instantiation of optional with a non-object type is undefined behavior}}
43 // expected-error-re@optional:* {{static assertion failed{{.*}}instantiation of optional with a non-destructible type is ill-formed}}
44 // expected-error@optional:* 1+ {{cannot form a reference to 'void'}}
45 optional<const void> opt4;
47 // FIXME these are garbage diagnostics that Clang should not produce
48 // expected-error@optional:* 0+ {{is not a base class}}
50 return 0;