Commit e7c6715e by Iain Buclaw

re PR d/90602 (ICE: null field)

	PR d/90602
d/dmd: Merge upstream dmd 420cce2a6

Fixes internal compiler error during CTFE.

Reviewed-on: https://github.com/dlang/dmd/pull/9997

From-SVN: r272342
parent 22682e5b
c74e624c9a0a9e7e39f96b2f005f86e123df56c9 420cce2a654f14b8de4a75cbb5d4203fce8d4e0f
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository. merge done from the dlang/dmd repository.
...@@ -6053,10 +6053,17 @@ public: ...@@ -6053,10 +6053,17 @@ public:
result = (*se->elements)[i]; result = (*se->elements)[i];
if (!result) if (!result)
{ {
// https://issues.dlang.org/show_bug.cgi?id=19897
// Zero-length fields don't have an initializer.
if (v->type->size() == 0)
result = voidInitLiteral(e->type, v).copy();
else
{
e->error("Internal Compiler Error: null field %s", v->toChars()); e->error("Internal Compiler Error: null field %s", v->toChars());
result = CTFEExp::cantexp; result = CTFEExp::cantexp;
return; return;
} }
}
if (result->op == TOKvoid) if (result->op == TOKvoid)
{ {
VoidInitExp *ve = (VoidInitExp *)result; VoidInitExp *ve = (VoidInitExp *)result;
......
// PERMUTE_ARGS:
/*
TEST_OUTPUT
---
fail_compilation/fail19897.d(10): Error: cannot implicitly convert expression `[]` of type `const(char[0])` to `const(char)`
---
*/
struct S
{
char[0] x;
}
const a = S('a');
const char c = a.x;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment