diff options
Diffstat (limited to 'test/SemaCXX/return-noreturn.cpp')
-rw-r--r-- | test/SemaCXX/return-noreturn.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/SemaCXX/return-noreturn.cpp b/test/SemaCXX/return-noreturn.cpp new file mode 100644 index 0000000..9242d12 --- /dev/null +++ b/test/SemaCXX/return-noreturn.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify -Wmissing-noreturn -Wno-unreachable-code + +// A destructor may be marked noreturn and should still influence the CFG. +namespace PR6884 { + struct abort_struct { + abort_struct() {} // Make this non-POD so the destructor is invoked. + ~abort_struct() __attribute__((noreturn)); + }; + + int f() { + abort_struct(); + } + + int f2() { + abort_struct s; + } // expected-warning{{control reaches end of non-void function}} +} |