• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2022 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// This is a "No Compile Test" suite.
6// http://dev.chromium.org/developers/testing/no-compile-tests
7
8#include "base/functional/overloaded.h"
9
10#include "third_party/abseil-cpp/absl/types/variant.h"
11
12namespace base {
13
14#if defined(TEST_LAMDA_MISSING_FOR_A_VARIANT_OPTION)  // [r"error: no type named 'type' in 'absl::type_traits_internal::result_of<base::Overloaded<\(lambda at *\)> \(PackageB &\)>'"]
15  struct PackageA {};
16  struct PackageB {};
17
18  absl::variant<PackageA, PackageB> var = PackageA();
19  absl::visit(
20      Overloaded{[](PackageA& pack) { return "PackageA"; }},
21      var);
22
23#endif
24
25}  // namespace base