1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This test case checks specifically the cases under C++ ABI 15.3.1, and 15.3.2
12 // A handler is a match for an exception object of type E if
13 // > * The handler is of type cv T or cv T& and E and T are the same type <
14 // > (ignoring the top-level cv-qualifiers), or <
15 // > * the handler is of type cv T or cv T& and T is an unambiguous base <
17 // * the handler is of type cv1 T* cv2 and E is a pointer type that can
18 // be converted to the type of the handler by either or both of
19 // o a standard pointer conversion (4.10 [conv.ptr]) not involving
20 // conversions to private or protected or ambiguous classes
21 // o a qualification conversion
22 // * the handler is a pointer or pointer to member type and E is
25 //===----------------------------------------------------------------------===//
27 // UNSUPPORTED: no-exceptions
29 // Compilers emit warnings about exceptions of type 'Child' being caught by
30 // an earlier handler of type 'Base'. Congrats, you've just diagnosed the
31 // behavior under test.
32 // ADDITIONAL_COMPILE_FLAGS: -Wno-exceptions
44 struct Child
: public Base
, public Base2
{
61 throw static_cast<Base2
&>(child
);
69 throw static_cast<Base2
*>(&child
);
79 catch (const Child
& c
)
101 catch (const Child
& b
)
115 catch (const Base2
& c
)
119 catch (const Child
& b
)
133 catch (const Child
& c
)
137 catch (const Base
& b
)
141 catch (const Base2
& b
)
155 catch (const Base
* c
)
159 catch (const Child
* b
)
163 catch (const Base2
* c
)