diff options
author | Iain Buclaw <ibuclaw@gcc.gnu.org> | 2019-06-16 07:49:18 +0000 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gcc.gnu.org> | 2019-06-16 07:49:18 +0000 |
commit | e5338b0449f4382594c86ec0f3ea6d9958aeeef5 (patch) | |
tree | 62bbe6883a0c080b16d928e0125af0935eba8d7d /gcc/d | |
parent | 88ad43b1f91f7cd2ba9c342c6c1a6da82e6088bf (diff) | |
download | gcc-e5338b0449f4382594c86ec0f3ea6d9958aeeef5.zip gcc-e5338b0449f4382594c86ec0f3ea6d9958aeeef5.tar.gz gcc-e5338b0449f4382594c86ec0f3ea6d9958aeeef5.tar.bz2 |
re PR d/90761 (ICE in visit, at d/dmd/dcast.c:883)
PR d/90761
d/dmd: Merge upstream dmd d912f4e49
Fixes segmentation fault in implicitConvTo::ImplicitConvTo::visit.
Reviewed-on: https://github.com/dlang/dmd/pull/10005
From-SVN: r272346
Diffstat (limited to 'gcc/d')
-rw-r--r-- | gcc/d/dmd/MERGE | 2 | ||||
-rw-r--r-- | gcc/d/dmd/expressionsem.c | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index 7b46e8f..865462d 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -3be8a80bb0c4e01c436be970ac3555ceabb3caf8 +d912f4e495412b67f0a2e3b07f645909cfee0212 The first line of this file holds the git revision number of the last merge done from the dlang/dmd repository. diff --git a/gcc/d/dmd/expressionsem.c b/gcc/d/dmd/expressionsem.c index 5177f9f..2957c09 100644 --- a/gcc/d/dmd/expressionsem.c +++ b/gcc/d/dmd/expressionsem.c @@ -75,6 +75,7 @@ Expression *semantic(Expression *e, Scope *sc); Expression *semanticY(DotIdExp *exp, Scope *sc, int flag); Expression *semanticY(DotTemplateInstanceExp *exp, Scope *sc, int flag); StringExp *semanticString(Scope *sc, Expression *exp, const char *s); +Initializer *semantic(Initializer *init, Scope *sc, Type *t, NeedInterpret needInterpret); /**************************************** * Preprocess arguments to function. @@ -1226,6 +1227,23 @@ public: exp->error("no constructor for %s", cd->toChars()); return setError(); } + + // https://issues.dlang.org/show_bug.cgi?id=19941 + // Run semantic on all field initializers to resolve any forward + // references. This is the same as done for structs in sd->fill(). + for (ClassDeclaration *c = cd; c; c = c->baseClass) + { + for (size_t i = 0; i < c->fields.dim; i++) + { + VarDeclaration *v = c->fields[i]; + if (v->inuse || v->_scope == NULL || v->_init == NULL || + v->_init->isVoidInitializer()) + continue; + v->inuse++; + v->_init = semantic(v->_init, v->_scope, v->type, INITinterpret); + v->inuse--; + } + } } } else if (tb->ty == Tstruct) |