aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/return.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-10-04 23:52:29 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-10-04 23:52:29 +0000
commit36ef0d54cfddf31cd48816e78ab4db73b31a6c1d (patch)
treea7b58d06715aadcfe6ff90abdf525f2ab1dfdbef /test/CodeGenCXX/return.cpp
parentc339393067438596599b142a8950f0e8694e2f1a (diff)
If we flow off the end of a value-returning function:
- outside C++, return undef (behavior is not undefined unless the value is used) - in C++, with -fcatch-undefined-behavior, perform an appropriate trap - in C++, produce an 'unreachable' (behavior is undefined immediately) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165273 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/return.cpp')
-rw-r--r--test/CodeGenCXX/return.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/CodeGenCXX/return.cpp b/test/CodeGenCXX/return.cpp
new file mode 100644
index 0000000000..2af1a5266e
--- /dev/null
+++ b/test/CodeGenCXX/return.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+
+// CHECK: @_Z9no_return
+int no_return() {
+ // CHECK: unreachable
+}