summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/attr-noreturn.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/attr-noreturn.cpp')
-rw-r--r--test/SemaCXX/attr-noreturn.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/SemaCXX/attr-noreturn.cpp b/test/SemaCXX/attr-noreturn.cpp
new file mode 100644
index 0000000..e4fdc08
--- /dev/null
+++ b/test/SemaCXX/attr-noreturn.cpp
@@ -0,0 +1,30 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+// PR5620
+void f0() __attribute__((__noreturn__));
+void f1(void (*)());
+void f2() { f1(f0); }
+
+// Taking the address of a noreturn function
+void test_f0a() {
+ void (*fp)() = f0;
+ void (*fp1)() __attribute__((noreturn)) = f0;
+}
+
+// Taking the address of an overloaded noreturn function
+void f0(int) __attribute__((__noreturn__));
+
+void test_f0b() {
+ void (*fp)() = f0;
+ void (*fp1)() __attribute__((noreturn)) = f0;
+}
+
+// No-returned function pointers
+typedef void (* noreturn_fp)() __attribute__((noreturn));
+
+void f3(noreturn_fp); // expected-note{{candidate function}}
+
+void test_f3() {
+ f3(f0); // okay
+ f3(f2); // expected-error{{no matching function for call}}
+}
OpenPOWER on IntegriCloud