From: Hans Wennborg Date: Thu, 30 Jun 2011 15:48:23 +0000 (+0000) Subject: Test for errors for returning a value from a ctor or dtor. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=62273f91b69f0f6586a00491751057c4173b893c;p=clang 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 --- 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}} + } +};