void bar() { mutex m; m.acquire(); may_throw(); m.release(); }
void sample::my_class::my_function(bool value) { neam::r::function_call self_call(N_PRETTY_NAME_INFO("sample::my_class::my_function(bool)")); if (value == get_top_value()) { may_throw(0); } }
bool ends_with_may_throw(Block* p) { for (auto last = p->rbegin(); last != p->rend(); ++last) { if (last->type != MFLOW_OPCODE) { continue; } return may_throw(last->insn->opcode()); } return true; }
X test5() { try { may_throw(); } catch (X x) { // CHECK-EH: invoke {{.*}} @_ZN1XC1ERKS_ // CHECK-EH: call void @__cxa_end_catch() // CHECK-EH: ret void return x; } }
void foo(mutex & m) { m.acquire(); may_throw(); m.release(); }
void never_throws() noexcept(true) { may_throw(); }
// { dg-options -std=c++11 } constexpr int may_throw(bool decide) { return decide ? 42 : throw -1; // { dg-error "throw" } } constexpr int x = may_throw(false); // { dg-message "may_throw" } constexpr int y = may_throw(true);