1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23
10 // The tested functionality needs deducing this.
11 // UNSUPPORTED: clang-17
17 // template<class Self, class Visitor>
18 // constexpr decltype(auto) visit(this Self&&, Visitor&&); // since C++26
19 // template<class R, class Self, class Visitor>
20 // constexpr R visit(this Self&&, Visitor&&); // since C++26
24 #include "test_macros.h"
32 constexpr bool test(bool do_it
) {
34 std::variant
<Holder
<Incomplete
>*, int> v
= nullptr;
37 v
.visit([](auto) -> Holder
<Incomplete
>* { return nullptr; });
38 v
.visit
<void>([](auto) {});
39 v
.visit
<void*>([](auto) -> Holder
<Incomplete
>* { return nullptr; });
44 int main(int, char**) {
46 static_assert(test(true));