Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Sema / MicrosoftExtensions.cpp
blobd2ce2e200f2466d644cec1198c9b1eb86e223038
1 // RUN: %clang_cc1 -triple i686-windows %s -fsyntax-only -Wmicrosoft -verify -fms-extensions
2 // RUN: %clang_cc1 -triple x86_64-windows %s -fsyntax-only -Wmicrosoft -verify -fms-extensions
4 // Check that __ptr32/__ptr64 can be compared.
5 int test_ptr_comparison(int *__ptr32 __uptr p32u, int *__ptr32 __sptr p32s,
6 int *__ptr64 p64) {
7 return (p32u == p32s) +
8 (p32u == p64) +
9 (p32s == p64);
12 template<typename T>
13 void bad(T __ptr32 a) { // expected-error {{'__ptr32' attribute only applies to pointer arguments}}`
14 (*a) += 1;
17 template<int size_expected, typename T>
18 void f(T a) {
19 (*a) += sizeof(a);
20 static_assert(sizeof(a) == size_expected, "instantiated template argument has unexpected size");
22 void g(int *p) {
23 // instantiate for default sized pointer
24 f<sizeof(void*)>(p);
27 void h(int *__ptr32 p) {
28 // instantiate for 32-bit pointer
29 f<4>(p);