[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / ms-constexpr-new.cpp
blob30567740b2ecbbe383f4ce4c0f70d6f9f29148b7
1 // RUN: %clang_cc1 -fms-compatibility -fms-compatibility-version=19.33 -std=c++20 -verify=supported %s
2 // RUN: %clang_cc1 -fms-compatibility -fms-compatibility-version=19.32 -std=c++20 -verify=unsupported %s
3 // supported-no-diagnostics
5 [[nodiscard]]
6 [[msvc::constexpr]] // unsupported-warning {{unknown attribute 'constexpr' ignored}}
7 inline void* operator new(decltype(sizeof(void*)), void* p) noexcept { return p; }
9 namespace std {
10 constexpr int* construct_at(int* p, int v) {
11 [[msvc::constexpr]] return ::new (p) int(v); // unsupported-warning {{unknown attribute 'constexpr' ignored}}
15 constexpr bool check_construct_at() { int x; return *std::construct_at(&x, 42) == 42; }
16 static_assert(check_construct_at());