27 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include <__cxx03/__utility/no_destroy.h>10#include <cassert>11 12#include "test_macros.h"13 14struct DestroyLast {15 ~DestroyLast() { assert(*ptr == 5); }16 17 int* ptr;18} last;19 20static std::__no_destroy<int> nd_int(5);21 22int main(int, char**) {23 last.ptr = &nd_int.__get();24 25 return 0;26}27