aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2021-07-26 19:10:47 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2021-07-30 12:51:36 +0200
commit370f66b6af3e70ac31593d60a00d328a3368834a (patch)
tree299c2b20996e928ac4ea7974c38c109ecdc02360
parente22b7ae15b09aef1ec05dec6e24580d0063e9ab1 (diff)
downloadgcc-370f66b6af3e70ac31593d60a00d328a3368834a.zip
gcc-370f66b6af3e70ac31593d60a00d328a3368834a.tar.gz
gcc-370f66b6af3e70ac31593d60a00d328a3368834a.tar.bz2
d: Only handle named enums in enum_initializer_decl
Anonymous enums neither generate an initializer nor typeinfo symbol, so it's safe to assert that all enum declarations passed to this function always have an identifier. gcc/d/ChangeLog: * decl.cc (enum_initializer_decl): Only handle named enums.
-rw-r--r--gcc/d/decl.cc7
1 files changed, 2 insertions, 5 deletions
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index cf61cd4..0d46ee1 100644
--- a/gcc/d/decl.cc
+++ b/gcc/d/decl.cc
@@ -2218,13 +2218,10 @@ enum_initializer_decl (EnumDeclaration *decl)
if (decl->sinit)
return decl->sinit;
- tree type = build_ctype (decl->type);
+ gcc_assert (decl->ident);
- Identifier *ident_save = decl->ident;
- if (!decl->ident)
- decl->ident = Identifier::generateId ("__enum");
+ tree type = build_ctype (decl->type);
tree ident = mangle_internal_decl (decl, "__init", "Z");
- decl->ident = ident_save;
decl->sinit = declare_extern_var (ident, type);
DECL_LANG_SPECIFIC (decl->sinit) = build_lang_decl (NULL);