<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62256>62256</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[exception handler] Could not catch an inherit exception object.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
joyhou-hw
</td>
</tr>
</table>
<pre>
Here is a different behavior about exceptin catch.
clang code [usr libc++ and libc++abi ] could NOT catch the object as base class type when the ex object is inerited class.
While gcc can.
```
struct A {};
struct B : virtual A {};
struct C : virtual A {};
struct D : virtual A {};
struct E : private B, public C, private D {};
extern "C" void abort ();
void fne (E *e)
{
throw e;
}
void check(E *e)
{
int caught;
caught = 0;
try { fne(e); }
catch(A *p) { caught = 1; if (p != e) abort();} // <--- g++ will catched here
catch(...) { abort(); } // <--- clang will catched here
if (!caught) abort();
return;
}
int main ()
{
E e;
check (&e);
check ((E *)0);
return 0;
}
```
the above is a parts code of gun dejia testsuit.
And my doubtful points are:
1: Is this different behavior g++ vs clang?
2: where could I got the list of different behavior about the abi part.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVcmu6ygQ_ZrKphTLIc7ghRcZbtRv071pqdcYKja3CViAk5u_b2Gcl-F2np4VEZs6NXHgwL1XjSGqYLGFxX7C-9BaV33aa2v7aXuZ1FZeK8j3kG_-IEeoPHKU6ngkRyZgTS0_K-uQ17YPSF-CuqAMCh5EmyU_oblpUFhJCItt7x1qVQtgW2Bb5EY-fPJaISz2iML2WuKff_2dImFoCW39SSIg91hzTyg09x7DtSPES0tmwNDXDaY8KkNOBZIJOlbzT6s0YSMECm4yTJNP4zIff8OnD64XATcIqy2s9jDfPs1vEeYbPCsXeq7fona_hdr_FupjQHVOnXkg3ALbYdfXWgncDe-jYf_qnkb6CuQMAmM7YAzPVsnInQsIbA2sfIEP9qOhaP1AYBuKmARYjUjE0Dp7Qbr7rvbfgoiWxL-_jKJMQMH7pg0vReA4jTDfY_7TiBjcNXYZCwS2plQ-_syOafMAW29i0g5YOcAfos2igzrG9joENotzMU5ak_uSrPaYHmAHYAeE-W46nWIz7uKL0jolI4ktOXotIMuyW_bnyHgP_eZ5zpgO0_uEqRdgs3Elv7cyAh2F3pl3lEUuTlyZ26544erjkexbq5HghF_Sc64HU-IfWJl_32y3oh44finr5WymMZ57XtvzKE4dd8EnubFHbHqDkj4Vx0A--F6F7NF3YySerihtX4djr7GzygSP3BHMR8gsHrcfHkOr_P8p320PnH0iB-aHUVVY9LxEdkY9-4GNDYNOaeVDLO-tkqam1NDNU8UTWc1lOS_5hKrZcj0rV2VeFJO2klyWJZNrQce6PObFgi94nc-KgpZ5vljUE1WxnM3zguX5mhV5kfHjitdsuSpmUnC5LqHI6cSVzrQ-nzLrmonyvqdqydhiOdG8Ju2Hi4IxQxccjMBYvDdcFX2mdd94KPLYnb9HCSro4YYZrwdrsOVGanKD1u-GtTE2jFrPDSrTRunGu0NS9WzSO121IXQ-8jOcjEaFtq8zYU_ADjHn-DftnI0-wA5DpR7YYejkvwAAAP__8of7mw">