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