brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · fe4961b Raw
33 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++1410 11// <variant>12 13// LWG issue 302414 15#include <variant>16#include <type_traits>17 18struct NotCopyConstructible19{20    NotCopyConstructible() = default;21    NotCopyConstructible(NotCopyConstructible const&) = delete;22};23 24int main(int, char**)25{26    static_assert(!std::is_copy_constructible_v<NotCopyConstructible>);27 28    std::variant<NotCopyConstructible> v;29    std::variant<NotCopyConstructible> v1;30    std::variant<NotCopyConstructible> v2(v); // expected-error {{call to implicitly-deleted copy constructor of 'std::variant<NotCopyConstructible>'}}31    v1 = v; // expected-error-re {{object of type 'std:{{.*}}:variant<NotCopyConstructible>' cannot be assigned because its copy assignment operator is implicitly deleted}}32}33