Fix Iss24061 - constructor with assert(0) failed to compile (#15489)

This commit is contained in:
Razvan Nitu 2023-08-01 17:20:03 +03:00 committed by GitHub
parent c187d643ed
commit ba5c402161
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View file

@ -705,7 +705,7 @@ private extern(C++) final class Semantic3Visitor : Visitor
}
sc2.ctorflow.freeFieldinit();
if (cd && !(sc2.ctorflow.callSuper & CSX.any_ctor) && cd.baseClass && cd.baseClass.ctor)
if (cd && !(sc2.ctorflow.callSuper & (CSX.any_ctor | CSX.halt)) && cd.baseClass && cd.baseClass.ctor)
{
sc2.ctorflow.callSuper = CSX.none;

View file

@ -0,0 +1,15 @@
// https://issues.dlang.org/show_bug.cgi?id=24061
class Exception2
{
this(string, int) {}
}
class E : Exception2
{
this(int i)
{
scope (success) assert(0, "assume nothrow");
super("hehe", 2);
}
}