Debian Codegraph @

libstdc++-v3/testsuite/20_util/optional/requirements_neg.cc

raw
1 // { dg-do compile { target c++17 } }
2
3 #include <optional>
4
5 // T shall be a type other than cv in_place_t or cv nullopt_t
6 // that meets the Cpp17Destructible requirements
7
8 std::optional<std::nullopt_t> o1; // { dg-error "here" }
9 std::optional<const std::nullopt_t> o2; // { dg-error "here" }
10 std::optional<std::in_place_t> o3; // { dg-error "here" }
11 std::optional<const std::in_place_t> o4; // { dg-error "here" }
12 std::optional<int&> o5; // { dg-error "here" }
13 std::optional<int[1]> o6; // { dg-error "here" }
14 std::optional<int[]> o7; // { dg-error "here" }
15 std::optional<int()> o8; // { dg-error "here" }
16
17 // { dg-error "static assertion failed" "" { target *-*-* } 0 }
18
19 // { dg-prune-output "forming pointer to reference type" }
20 // { dg-prune-output "union may not have reference type" }
21 // { dg-prune-output "function returning an array" }
22 // { dg-prune-output "flexible array member .* in union" }
23 // { dg-prune-output "function returning a function" }
24 // { dg-prune-output "invalidly declared function type" }