summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/attr-unavailable.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-18 21:56:37 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-18 21:56:37 +0000
commit171c45ab0c19bbd28cd335662c14bf0387c811d0 (patch)
treef91384ec5a11fde7148887bf569085cdaf57d851 /clang/test/SemaCXX/attr-unavailable.cpp
parent96207699013c52344b58c2a9a979c9ba7ac256b0 (diff)
downloadbcm5719-llvm-171c45ab0c19bbd28cd335662c14bf0387c811d0.tar.gz
bcm5719-llvm-171c45ab0c19bbd28cd335662c14bf0387c811d0.zip
Downgrade complaints about calling unavailable functions to a warning
(as GCC does), except when we've performed overload resolution and found an unavailable function: in this case, we actually error. Merge the checking of unavailable functions with the checking for deprecated functions. This unifies a bit of code, and makes sure that we're checking for unavailable functions in the right places. Also, this check can cause an error. We may, eventually, want an option to make "unavailable" warnings into errors. Implement much of the logic needed for C++0x deleted functions, which are effectively the same as "unavailable" functions (but always cause an error when referenced). However, we don't have the syntax to specify deleted functions yet :) llvm-svn: 64955
Diffstat (limited to 'clang/test/SemaCXX/attr-unavailable.cpp')
-rw-r--r--clang/test/SemaCXX/attr-unavailable.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/attr-unavailable.cpp b/clang/test/SemaCXX/attr-unavailable.cpp
index 140008a4cba..78e348ae1f6 100644
--- a/clang/test/SemaCXX/attr-unavailable.cpp
+++ b/clang/test/SemaCXX/attr-unavailable.cpp
@@ -2,10 +2,19 @@
int &foo(int);
double &foo(double);
-void foo(...) __attribute__((__unavailable__)); // expected-note{{unavailable function is declared here}}
+void foo(...) __attribute__((__unavailable__)); // expected-note {{candidate function}} \
+// expected-note{{function has been explicitly marked unavailable here}}
+
+void bar(...) __attribute__((__unavailable__)); // expected-note 2{{explicitly marked unavailable}}
void test_foo(short* sp) {
int &ir = foo(1);
double &dr = foo(1.0);
- foo(sp); // expected-error{{call to function 'foo' that has been intentionally made unavailable}}
+ foo(sp); // expected-error{{call to unavailable function 'foo'}}
+
+ void (*fp)(...) = &bar; // expected-warning{{'bar' is unavailable}}
+ void (*fp2)(...) = bar; // expected-warning{{'bar' is unavailable}}
+
+ int &(*fp3)(int) = foo;
+ void (*fp4)(...) = foo; // expected-warning{{'foo' is unavailable}}
}
OpenPOWER on IntegriCloud