1 // RUN: %check_clang_tidy -std=c++11,c++14,c++17,c++20 %s bugprone-exception-escape %t -- \ 2 // RUN: -- -fexceptions 3 rethrower()4void rethrower() { 5 throw; 6 } 7 callsRethrower()8void callsRethrower() { 9 rethrower(); 10 } 11 callsRethrowerNoexcept()12void callsRethrowerNoexcept() noexcept { 13 rethrower(); 14 } 15 throwsAndCallsRethrower()16int throwsAndCallsRethrower() noexcept { 17 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: an exception may be thrown in function 'throwsAndCallsRethrower' which should not throw exceptions 18 try { 19 throw 1; 20 } catch(...) { 21 rethrower(); 22 } 23 } 24 throwsAndCallsCallsRethrower()25int throwsAndCallsCallsRethrower() noexcept { 26 // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: an exception may be thrown in function 'throwsAndCallsCallsRethrower' which should not throw exceptions 27 try { 28 throw 1; 29 } catch(...) { 30 callsRethrower(); 31 } 32 } 33 rethrowerNoexcept()34void rethrowerNoexcept() noexcept { 35 throw; 36 } 37