31 lines · cpp
1// RUN: %clang_cc1 "-triple" "arm64-apple-macosx10.15" -fsyntax-only -verify %s2 3__attribute__((availability(macos,introduced=11)))4inline bool try_acquire() {5 return true;6}7 8template <class T>9__attribute__((availability(macos,introduced=11)))10bool try_acquire_for(T duration) { // expected-note{{'try_acquire_for<int>' has been marked as being introduced in macOS 11 here, but the deployment target is macOS 10.15}}11 return try_acquire();12}13 14int main() {15 try_acquire_for(1); // expected-warning{{'try_acquire_for<int>' is only available on macOS 11 or newer}}16 // expected-note@-1{{enclose 'try_acquire_for<int>' in a __builtin_available check to silence this warning}}17}18 19namespace typename_template {20 struct [[clang::availability(macos, introduced = 16)]] A {};21 22 template<class T> struct B { using type = T; };23 template <class T> struct C {24 typename B<T>::type v;25 };26 27 struct [[clang::availability(macos, introduced = 16)]] D {28 C<A> c;29 };30} // namespace typename_template31