]> granicus.if.org Git - clang/commitdiff
Test for errors for returning a value from a ctor or dtor.
authorHans Wennborg <hans@hanshq.net>
Thu, 30 Jun 2011 15:48:23 +0000 (15:48 +0000)
committerHans Wennborg <hans@hanshq.net>
Thu, 30 Jun 2011 15:48:23 +0000 (15:48 +0000)
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

test/Sema/return.cpp [new file with mode: 0644]

diff --git a/test/Sema/return.cpp b/test/Sema/return.cpp
new file mode 100644 (file)
index 0000000..754bc98
--- /dev/null
@@ -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}}
+  }
+};