summaryrefslogtreecommitdiff
path: root/chromium/base/strings/string_piece_unittest.nc
blob: eb007430fe96d43b7cff55bae5988299c418f4dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// This is a "No Compile Test" suite.
// http://dev.chromium.org/developers/testing/no-compile-tests

#include "base/strings/string_piece.h"

#include <string>

namespace base {

#if defined(NCTEST_DANGLING_XVALUE)  // [r"object backing the pointer will be destroyed at the end of the full-expression"]

// Returns a std::string xvalue (temporary object).
std::string f() { return std::string(); };


void HoldsDanglingReferenceToString() {
  [[maybe_unused]] StringPiece piece = f();
}

#endif

}  // namespace base