49 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify %s2// expected-no-diagnostics3 4template <typename T>5void test_is_pointer() {6 static_assert(__is_pointer(T), "");7 8 static_assert(__is_pointer(T __weak), "");9 static_assert(__is_pointer(T __strong), "");10 static_assert(__is_pointer(T __autoreleasing), "");11 static_assert(__is_pointer(T __unsafe_unretained), "");12 13 static_assert(__is_pointer(T __weak const), "");14 static_assert(__is_pointer(T __strong const), "");15 static_assert(__is_pointer(T __autoreleasing const), "");16 static_assert(__is_pointer(T __unsafe_unretained const), "");17 18 static_assert(__is_pointer(T __weak volatile), "");19 static_assert(__is_pointer(T __strong volatile), "");20 static_assert(__is_pointer(T __autoreleasing volatile), "");21 static_assert(__is_pointer(T __unsafe_unretained volatile), "");22 23 static_assert(__is_pointer(T __weak const volatile), "");24 static_assert(__is_pointer(T __strong const volatile), "");25 static_assert(__is_pointer(T __autoreleasing const volatile), "");26 static_assert(__is_pointer(T __unsafe_unretained const volatile), "");27}28 29@class Foo;30 31int main(int, char**) {32 test_is_pointer<id>();33 test_is_pointer<id const>();34 test_is_pointer<id volatile>();35 test_is_pointer<id const volatile>();36 37 test_is_pointer<Foo*>();38 test_is_pointer<Foo const*>();39 test_is_pointer<Foo volatile*>();40 test_is_pointer<Foo const volatile*>();41 42 test_is_pointer<void*>();43 test_is_pointer<void const*>();44 test_is_pointer<void volatile*>();45 test_is_pointer<void const volatile*>();46 47 return 0;48}49