fix bugzilla Issue 23515 - Named Enum of function SIGSEGFAULT (#16117)

* fix 23515

* fix bugzilla Issue 23515 - Named Enum of function SIGSEGFAULT
This commit is contained in:
Walter Bright 2024-01-30 15:41:45 -08:00 committed by GitHub
parent 632e04dfff
commit 849cb90272
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 0 deletions

View file

@ -503,6 +503,8 @@ void enumMemberSemantic(Scope* sc, EnumMember em)
{ {
Expression e = em.value; Expression e = em.value;
assert(e.dyncast() == DYNCAST.expression); assert(e.dyncast() == DYNCAST.expression);
if (em.ed.memtype)
e = inferType(e, em.ed.memtype);
e = e.expressionSemantic(sc); e = e.expressionSemantic(sc);
e = resolveProperties(sc, e); e = resolveProperties(sc, e);
e = e.ctfeInterpret(); e = e.ctfeInterpret();

View file

@ -155,6 +155,19 @@ class C7379
} }
} }
/***********************************/
// https://issues.dlang.org/show_bug.cgi?id=23515
enum Easing : void function()
{
identity1 = (){},
}
void test23515()
{
Easing.identity1();
}
/***********************************/ /***********************************/
int main() int main()
@ -166,6 +179,7 @@ int main()
test5(); test5();
test6(); test6();
test7(); test7();
test23515();
printf("Success\n"); printf("Success\n");
return 0; return 0;