49 lines · cpp
1// Build with "cl.exe /Zi /GR- /GX- every-pointer.cpp /link /debug /nodefaultlib /incremental:no /entry:main"2 3#include <stdint.h>4 5// clang-format off6void *__purecall = 0;7 8void __cdecl operator delete(void *,unsigned int) {}9void __cdecl operator delete(void *,unsigned __int64) {}10 11 12struct Foo {13 int X = 0;14 int func() { return 42; }15};16 17int *IntP = nullptr;18Foo *FooP = nullptr;19 20Foo F;21 22Foo __unaligned *UFooP = &F;23Foo * __restrict RFooP = &F;24 25const Foo * CFooP = &F;26volatile Foo * VFooP = &F;27const volatile Foo * CVFooP = &F;28 29template<typename T> void f(T t) {}30 31int main(int argc, char **argv) {32 f<int*>(IntP);33 f<Foo*>(FooP);34 35 f<Foo __unaligned *>(UFooP);36 f<Foo *__restrict>(RFooP);37 38 f<const Foo*>(CFooP);39 f<volatile Foo*>(VFooP);40 f<const volatile Foo*>(CVFooP);41 42 f<Foo&>(F);43 f<Foo&&>(static_cast<Foo&&>(F));44 45 f(&Foo::X);46 f(&Foo::func);47 return 0;48}49