summaryrefslogtreecommitdiffstats
path: root/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
commitc6666f8e9bbb7f31bf2e52f97137e738c4ca01d0 (patch)
treedf0b4fbf0b7db30dc79a52ce27432d6e34af80d4 /test/SemaCXX/attr-unavailable.cpp
parentf4b136fb40aeedeaaa6ce7cdff22f375eb76c47b (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64897 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/attr-unavailable.cpp')
-rw-r--r--test/SemaCXX/attr-unavailable.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/SemaCXX/attr-unavailable.cpp b/test/SemaCXX/attr-unavailable.cpp
new file mode 100644
index 0000000000..140008a4cb
--- /dev/null
+++ b/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}}
+}