xref: /aosp_15_r20/external/clang/test/SemaCXX/unreachable-catch-clauses.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s
2*67e74705SXin Li 
3*67e74705SXin Li class BaseEx {};
4*67e74705SXin Li class Ex1: public BaseEx {};
5*67e74705SXin Li typedef Ex1 Ex2;
6*67e74705SXin Li 
7*67e74705SXin Li void f();
8*67e74705SXin Li 
test()9*67e74705SXin Li void test()
10*67e74705SXin Li try {}
11*67e74705SXin Li catch (BaseEx &e) { f(); } // expected-note 2{{for type 'BaseEx &'}}
12*67e74705SXin Li catch (Ex1 &e) { f(); } // expected-warning {{exception of type 'Ex1 &' will be caught by earlier handler}}
13*67e74705SXin Li catch (Ex2 &e) { f(); } // expected-warning {{exception of type 'Ex2 &' (aka 'Ex1 &') will be caught by earlier handler}}
14