Files
clang-p2996/libcxx/test/std/utilities/memory/ptr.align/assume_aligned.nodiscard.verify.cpp
Louis Dionne c292b6066c [libc++] Implement P1007R3: std::assume_aligned
This supersedes and incoroporates content from both D108906 and D54966,
and also some original content.

Co-Authored-by: Marshall Clow <mclow.lists@gmail.com>
Co-Authored-by: Gonzalo Brito Gadeschi

Differential Revision: https://reviews.llvm.org/D118938
2022-04-11 10:46:52 -04:00

23 lines
691 B
C++

//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11, c++14, c++17
// #include <memory>
// template<size_t N, class T>
// [[nodiscard]] constexpr T* assume_aligned(T* ptr);
#include <memory>
void f() {
int *p = nullptr;
std::assume_aligned<4>(p); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}
}