diff options
Diffstat (limited to 'clang/test/SemaCXX/warn-throw-out-noexcept-func.cpp')
-rw-r--r-- | clang/test/SemaCXX/warn-throw-out-noexcept-func.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/warn-throw-out-noexcept-func.cpp b/clang/test/SemaCXX/warn-throw-out-noexcept-func.cpp index 5e1c5714496..a6c23ddc6c8 100644 --- a/clang/test/SemaCXX/warn-throw-out-noexcept-func.cpp +++ b/clang/test/SemaCXX/warn-throw-out-noexcept-func.cpp @@ -239,13 +239,30 @@ void n_ShouldNotDiag() noexcept { } catch (const S &s) { } } -void o_ShouldDiag() noexcept { //expected-note {{function declared non-throwing here}} +// As seen in p34973, this should not throw the warning. If there is an active +// exception, catch(...) catches everything. +void o_ShouldNotDiag() noexcept { try { - throw; //expected-warning {{has a non-throwing exception specification but}} + throw; } catch (...) { } } +void p_ShouldDiag() noexcept { //expected-note {{function declared non-throwing here}} + try { + throw; //expected-warning {{has a non-throwing exception specification but}} + } catch (int){ + } +} + +void q_ShouldNotDiag() noexcept { + try { + throw; + } catch (int){ + } catch (...){ + } +} + #define NOEXCEPT noexcept void with_macro() NOEXCEPT { //expected-note {{function declared non-throwing here}} throw 1; // expected-warning {{has a non-throwing exception specification but}} |