aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/return.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2011-06-30 15:48:23 +0000
committerHans Wennborg <hans@hanshq.net>2011-06-30 15:48:23 +0000
commit62273f91b69f0f6586a00491751057c4173b893c (patch)
tree0a3309201475ef970eb4d87e493570984a4eee46 /test/Sema/return.cpp
parentd3fc7296ae95353173bae25ee4dd3ecf4d6dced1 (diff)
Test for errors for returning a value from a ctor or dtor.
This fell out when Chandler landed the patch in r134138. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134163 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/return.cpp')
-rw-r--r--test/Sema/return.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/Sema/return.cpp b/test/Sema/return.cpp
new file mode 100644
index 0000000000..754bc986b3
--- /dev/null
+++ b/test/Sema/return.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang %s -fsyntax-only -Wreturn-type
+
+struct C {
+ C() {
+ return 42; // expected-warning {{constructor 'C' should not return a value}}
+ }
+ ~C() {
+ return 42; // expected-warning {{destructor '~C' should not return a value}}
+ }
+};