opnsense-src/test/support/test.support/test_macros_header_exceptions.fail.cpp

25 lines
700 B
C++
Raw Normal View History

2015-09-06 14:46:46 -04:00
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// "support/test_macros.hpp"
2015-09-06 14:46:46 -04:00
// #define TEST_HAS_NO_EXCEPTIONS
2015-09-06 14:46:46 -04:00
#include "test_macros.h"
2015-09-06 14:46:46 -04:00
int main() {
#if defined(TEST_HAS_NO_EXCEPTIONS)
try { ((void)0); } catch (...) {} // expected-error {{exceptions disabled}}
2015-09-06 14:46:46 -04:00
#else
try { ((void)0); } catch (...) {}
#error exceptions enabled
// expected-error@-1 {{exceptions enabled}}
2015-09-06 14:46:46 -04:00
#endif
}