bolt/deps/llvm-18.1.8/clang/test/SemaCXX/disallow_void_deref.cpp

16 lines
508 B
C++
Raw Normal View History

2025-02-14 19:21:04 +01:00
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
void f(void* p) {
(void)*p; // expected-error{{indirection not permitted on operand of type 'void *'}}
}
template<class T>
concept deref = requires (T& t) {
{ *t }; // #FAILED_REQ
};
static_assert(deref<void*>);
// expected-error@-1{{static assertion failed}}
// expected-note@-2{{because 'void *' does not satisfy 'deref'}}
// expected-note@#FAILED_REQ{{because '*t' would be invalid: indirection not permitted on operand of type 'void *'}}