summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/attr-unavailable.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-18 06:34:51 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-18 06:34:51 +0000
commitb2809a0a1b07fa1ca9dbdab0bba5171adc7db476 (patch)
tree257017e4ce87e40a900a6c7331a010922615ae91 /clang/test/SemaCXX/attr-unavailable.cpp
parentd7670d9a96afef4e9fad2138b149520608d23741 (diff)
downloadbcm5719-llvm-b2809a0a1b07fa1ca9dbdab0bba5171adc7db476.tar.gz
bcm5719-llvm-b2809a0a1b07fa1ca9dbdab0bba5171adc7db476.zip
Don't allow calls to functions marked "unavailable". There's more work
to do in this area, since there are other places that reference FunctionDecls. Don't allow "overloadable" functions (in C) to be declared without a prototype. llvm-svn: 64897
Diffstat (limited to 'clang/test/SemaCXX/attr-unavailable.cpp')
-rw-r--r--clang/test/SemaCXX/attr-unavailable.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/attr-unavailable.cpp b/clang/test/SemaCXX/attr-unavailable.cpp
new file mode 100644
index 00000000000..140008a4cba
--- /dev/null
+++ b/clang/test/SemaCXX/attr-unavailable.cpp
@@ -0,0 +1,11 @@
+// RUN: clang -fsyntax-only -verify %s
+
+int &foo(int);
+double &foo(double);
+void foo(...) __attribute__((__unavailable__)); // expected-note{{unavailable function is declared here}}
+
+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}}
+}
OpenPOWER on IntegriCloud