mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-27 23:38:59 -04:00

Re-apply the change which was reverted in r363764 as-is after breakages being resolved. Thanks Eric Fiselier for working hard on this. See also: https://bugs.llvm.org/show_bug.cgi?id=42330 Differential Revision: https://reviews.llvm.org/D44865 llvm-svn: 363993
40 lines
1.6 KiB
C++
40 lines
1.6 KiB
C++
// -*- C++ -*-
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// UNSUPPORTED: c++98, c++03, c++11, c++14
|
|
|
|
// <variant>
|
|
|
|
// template <class ...Types> class variant;
|
|
|
|
// template <class T> constexpr variant(T&&) noexcept(see below);
|
|
|
|
#include <variant>
|
|
#include <string>
|
|
#include <memory>
|
|
|
|
int main(int, char**)
|
|
{
|
|
std::variant<int, int> v1 = 1; // expected-error {{no viable conversion}}
|
|
std::variant<long, long long> v2 = 1; // expected-error {{no viable conversion}}
|
|
std::variant<char> v3 = 1; // expected-error {{no viable conversion}}
|
|
|
|
std::variant<std::string, float> v4 = 1; // expected-error {{no viable conversion}}
|
|
std::variant<std::string, double> v5 = 1; // expected-error {{no viable conversion}}
|
|
std::variant<std::string, bool> v6 = 1; // expected-error {{no viable conversion}}
|
|
|
|
std::variant<int, bool> v7 = "meow"; // expected-error {{no viable conversion}}
|
|
std::variant<int, bool const> v8 = "meow"; // expected-error {{no viable conversion}}
|
|
std::variant<int, bool volatile> v9 = "meow"; // expected-error {{no viable conversion}}
|
|
|
|
std::variant<bool> v10 = std::true_type(); // expected-error {{no viable conversion}}
|
|
std::variant<bool> v11 = std::unique_ptr<char>(); // expected-error {{no viable conversion}}
|
|
std::variant<bool> v12 = nullptr; // expected-error {{no viable conversion}}
|
|
}
|