1 // Copyright 2018 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This is a "No Compile Test" suite.
6 // http://dev.chromium.org/developers/testing/no-compile-tests
8 #include "base/traits_bag.h"
12 enum class RequiredTrait {
18 struct NotAValidTrait {};
21 // List of traits that are valid inputs for the constructor below.
23 ValidTrait(RequiredTrait);
26 template <class... ArgTypes,
27 class CheckArgumentsAreValid = std::enable_if_t<
28 trait_helpers::AreValidTraits<ValidTrait, ArgTypes...>::value>>
29 constexpr TestTraits(ArgTypes... args)
30 : required_trait(trait_helpers::GetEnum<RequiredTrait>(args...)) {}
32 const RequiredTrait required_trait;
35 #if defined(NCTEST_TRAITS_BAG_REQUIRED_TRAIT_NOT_SET) // [r"The traits bag is missing a required trait."]
36 constexpr TestTraits traits = {};
37 #elif defined(NCTEST_TRAITS_BAG_INVALID_TRAIT) // [r"no matching constructor for initialization of 'const base::TestTraits'"]
38 constexpr TestTraits traits = {RequiredTrait::A, NotAValidTrait{}};