https://gcc.gnu.org/g:4abeaeba435054ad0ab59cf570620b37c06ffcc4

commit r14-11223-g4abeaeba435054ad0ab59cf570620b37c06ffcc4
Author: Iain Buclaw <ibuc...@gdcproject.org>
Date:   Fri Jan 17 20:10:39 2025 +0100

    d: Fix ICE in expand_d_format when diagnosing empty enum [PR117115]
    
    This was fixed in upstream dmd, and merged in r15-6824. Backport the
    individual fix from the upstream merge for releases/gcc-14.
    
            PR d/117115
    
    gcc/testsuite/ChangeLog:
    
            * gdc.dg/pr117115.d: New test.
    
    (cherry picked from commit 975c4f1a5de4ede89ee9499cd1a73d613a4aeae4)

Diff:
---
 gcc/d/dmd/enumsem.d             | 2 +-
 gcc/testsuite/gdc.dg/pr117115.d | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/d/dmd/enumsem.d b/gcc/d/dmd/enumsem.d
index 3886ca25e97b..06683b254907 100644
--- a/gcc/d/dmd/enumsem.d
+++ b/gcc/d/dmd/enumsem.d
@@ -186,7 +186,7 @@ void enumSemantic(Scope* sc, EnumDeclaration ed)
 
     if (ed.members.length == 0)
     {
-        .error(ed.loc, "%s `%s enum `%s` must have at least one member", 
ed.kind, ed.toPrettyChars, ed.toChars());
+        .error(ed.loc, "%s `%s` enum `%s` must have at least one member", 
ed.kind, ed.toPrettyChars, ed.toChars());
         ed.errors = true;
         ed.semanticRun = PASS.semanticdone;
         return;
diff --git a/gcc/testsuite/gdc.dg/pr117115.d b/gcc/testsuite/gdc.dg/pr117115.d
new file mode 100644
index 000000000000..b012268b509e
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr117115.d
@@ -0,0 +1,3 @@
+// { dg-do compile }
+
+enum E117115 {} // { dg-error "must have at least one member" }

Reply via email to