1// -*- C++ -*- 2//===----------------------------------------------------------------------===// 3// 4// The LLVM Compiler Infrastructure 5// 6// This file is dual licensed under the MIT and the University of Illinois Open 7// Source Licenses. See LICENSE.TXT for details. 8// 9//===----------------------------------------------------------------------===// 10 11// UNSUPPORTED: libcpp-no-exceptions 12// MODULES_DEFINES: _LIBCPP_DEBUG=1 13// MODULES_DEFINES: _LIBCPP_DEBUG_USE_EXCEPTIONS 14 15// Test that defining _LIBCPP_DEBUG_USE_EXCEPTIONS causes _LIBCPP_ASSERT 16// to throw on failure. 17 18#define _LIBCPP_DEBUG 1 19#define _LIBCPP_DEBUG_USE_EXCEPTIONS 20 21#include <cstdlib> 22#include <exception> 23#include <type_traits> 24#include <__debug> 25#include <cassert> 26 27int main() 28{ 29 try { 30 _LIBCPP_ASSERT(false, "foo"); 31 assert(false); 32 } catch (...) {} 33} 34