1 // RUN: %clang_cc1 -triple x86_64-apple-darwin9.0.0 -verify -std=c++11 %s 2 // RUN: %clang_cc1 -triple x86_64-apple-darwin9.0.0 -xobjective-c++ -verify -std=c++11 %s 3 4 #define BEGIN_PRAGMA _Pragma("clang attribute push (__attribute__((availability(macos, introduced=1000))), apply_to=function)") 5 #define END_PRAGMA _Pragma("clang attribute pop") 6 7 extern "C" { 8 BEGIN_PRAGMA 9 int f(); // expected-note{{'f' has been marked as being introduced in macOS 1000 here}} 10 END_PRAGMA 11 } 12 13 namespace my_ns { 14 BEGIN_PRAGMA 15 int g(); // expected-note{{'g' has been marked as being introduced in macOS 1000 here}} 16 END_PRAGMA 17 namespace nested { 18 BEGIN_PRAGMA 19 int h(); // expected-note{{'h' has been marked as being introduced in macOS 1000 here}} 20 END_PRAGMA 21 } 22 } 23 24 int a = f(); // expected-warning{{'f' is only available on macOS 1000 or newer}} expected-note{{annotate 'a'}} 25 int b = my_ns::g(); // expected-warning{{'g' is only available on macOS 1000 or newer}} expected-note{{annotate 'b'}} 26 int c = my_ns::nested::h(); // expected-warning{{'h' is only available on macOS 1000 or newer}} expected-note{{annotate 'c'}} 27 28 struct InStruct { 29 // FIXME: This asserts in Objective-C++! 30 // FIXME: This is a horrible diagnostic! 31 #ifndef __OBJC__ 32 BEGIN_PRAGMA // expected-error {{expected member name or ';' after declaration specifiers}} 33 #endif 34 }; 35