• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2023 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/strings/stringprintf.h"
9
10#include <string_view>
11#include <tuple>
12
13namespace base {
14
15void ConstexprStringView() {
16  static constexpr std::string_view kTest = "test %s";
17  std::ignore = StringPrintfNonConstexpr(kTest, "123");  // expected-error {{call to deleted function 'StringPrintfNonConstexpr'}}
18}
19
20void ConstexprCharArray() {
21  static constexpr char kTest[] = "test %s";
22  std::ignore = StringPrintfNonConstexpr(kTest, "123");  // expected-error {{call to deleted function 'StringPrintfNonConstexpr'}}
23}
24
25void ConstexprCharPointer() {
26  static constexpr const char* kTest = "test %s";
27  std::ignore = StringPrintfNonConstexpr(kTest, "123");  // expected-error {{call to deleted function 'StringPrintfNonConstexpr'}}
28}
29
30}  // namespace base
31