1// Copyright 2017 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/feature_list.h" 9#include "base/metrics/field_trial_params.h" 10 11namespace base { 12 13constexpr Feature kFeature{"NoCompileFeature", FEATURE_DISABLED_BY_DEFAULT}; 14 15// Must supply an enum template argument. 16constexpr FeatureParam<> kParam1{&kFeature, "Param"}; // expected-error {{too few template arguments}} 17constexpr FeatureParam<void> kParam2{&kFeature, "Param"}; // expected-error@*:* {{unsupported FeatureParam<> type}} 18constexpr FeatureParam<size_t> kParam3{&kFeature, "Param", 1u}; // expected-error@*:* {{unsupported FeatureParam<> type}} 19 20enum Param { kFoo, kBar }; 21 22// Options pointer must be non-null. 23constexpr FeatureParam<Param> kParam4{&kFeature, "Param", kFoo, nullptr}; // expected-error {{no matching constructor}} 24 25constexpr FeatureParam<Param>::Option kParamOptions[] = {}; 26constexpr FeatureParam<Param> kParam5{&kFeature, "Param", kFoo, &kParamOptions}; // expected-error {{no matching constructor}} 27 28} // namespace base 29