1// RUN: %clang_cc1 -fsyntax-only -verify %s 2 3int &foo(int); // expected-note {{candidate}} 4double &foo(double); // expected-note {{candidate}} 5void foo(...) __attribute__((__unavailable__)); // expected-note {{candidate function}} \ 6// expected-note{{'foo' has been explicitly marked unavailable here}} 7 8void bar(...) __attribute__((__unavailable__)); // expected-note 2{{explicitly marked unavailable}} 9 10void test_foo(short* sp) { 11 int &ir = foo(1); 12 double &dr = foo(1.0); 13 foo(sp); // expected-error{{call to unavailable function 'foo'}} 14 15 void (*fp)(...) = &bar; // expected-error{{'bar' is unavailable}} 16 void (*fp2)(...) = bar; // expected-error{{'bar' is unavailable}} 17 18 int &(*fp3)(int) = foo; 19 void (*fp4)(...) = foo; // expected-error{{'foo' is unavailable}} 20} 21 22namespace radar9046492 { 23// rdar://9046492 24#define FOO __attribute__((unavailable("not available - replaced"))) 25 26void foo() FOO; // expected-note {{candidate function has been explicitly made unavailable}} 27void bar() { 28 foo(); // expected-error {{call to unavailable function 'foo': not available - replaced}} 29} 30} 31 32void unavail(short* sp) __attribute__((__unavailable__)); 33void unavail(short* sp) { 34 // No complains inside an unavailable function. 35 int &ir = foo(1); 36 double &dr = foo(1.0); 37 foo(sp); 38 foo(); 39} 40 41// Show that delayed processing of 'unavailable' is the same 42// delayed process for 'deprecated'. 43// <rdar://problem/12241361> and <rdar://problem/15584219> 44enum DeprecatedEnum { DE_A, DE_B } __attribute__((deprecated)); // expected-note {{'DeprecatedEnum' has been explicitly marked deprecated here}} 45__attribute__((deprecated)) typedef enum DeprecatedEnum DeprecatedEnum; 46typedef enum DeprecatedEnum AnotherDeprecatedEnum; // expected-warning {{'DeprecatedEnum' is deprecated}} 47 48__attribute__((deprecated)) 49DeprecatedEnum testDeprecated(DeprecatedEnum X) { return X; } 50 51 52enum UnavailableEnum { UE_A, UE_B } __attribute__((unavailable)); // expected-note {{'UnavailableEnum' has been explicitly marked unavailable here}} 53__attribute__((unavailable)) typedef enum UnavailableEnum UnavailableEnum; 54typedef enum UnavailableEnum AnotherUnavailableEnum; // expected-error {{'UnavailableEnum' is unavailable}} 55 56 57__attribute__((unavailable)) 58UnavailableEnum testUnavailable(UnavailableEnum X) { return X; } 59