1// Copyright 2024 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// https://dev.chromium.org/developers/testing/no-compile-tests 7 8#include <string> 9#include <type_traits> 10 11#include "base/memory/structured_shared_memory.h" 12#include "base/memory/read_only_shared_memory_region.h" 13 14namespace base { 15 16namespace { 17 18struct NotTriviallyCopyable { 19 std::string data; 20}; 21 22static_assert(!std::is_trivially_copyable_v<NotTriviallyCopyable>); 23 24} // namespace 25 26void MustBeTriviallyCopyable() { 27 StructuredSharedMemory<NotTriviallyCopyable>::Create(); // expected-error@base/memory/structured_shared_memory.h:* {{no matching function for call to 'AssertSafeToMap'}} 28 StructuredSharedMemory<NotTriviallyCopyable>::MapReadOnlyRegion( 29 ReadOnlySharedMemoryRegion()); // expected-error@base/memory/structured_shared_memory.h:* {{no matching function for call to 'AssertSafeToMap'}} 30} 31 32} // namespace base 33