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 13BASE_FEATURE(kNoCompileFeature, "NoCompileFeature", FEATURE_DISABLED_BY_DEFAULT); 14 15// Must supply an enum template argument. 16constexpr FeatureParam<> kParam1{&kNoCompileFeature, "Param"}; // expected-error {{too few template arguments}} 17constexpr FeatureParam<float> kParam3{&kNoCompileFeature, "Param"}; // expected-error@*:* {{Unsupported FeatureParam<> type}} 18 19// expected-error@../../base/metrics/field_trial_params.h:37 {{cannot form a reference to 'void'}} 20// expected-error@../../base/metrics/field_trial_params.h:40 {{cannot form a reference to 'void'}} 21// expected-error@../../base/metrics/field_trial_params.h:204 {{Unsupported FeatureParam<> type}} 22constexpr FeatureParam<void> kParam2{&kNoCompileFeature, "Param"}; 23 24enum Param { kFoo, kBar }; 25 26// Options pointer must be non-null. 27constexpr FeatureParam<Param> kParam4{&kNoCompileFeature, "Param", kFoo, nullptr}; // expected-error {{no matching constructor}} 28 29constexpr FeatureParam<Param>::Option kParamOptions[] = {}; 30constexpr FeatureParam<Param> kParam5{&kNoCompileFeature, "Param", kFoo, &kParamOptions}; // expected-error {{no matching constructor}} 31 32} // namespace base 33