Showing with 16 additions and 0 deletions.
  1. +3 −0 src/aggregate.d
  2. +13 −0 test/fail_compilation/diag15340.d
3 changes: 3 additions & 0 deletions src/aggregate.d
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ public:
foreach (i; 0 .. nfields)
{
auto vd = fields[i];
if (vd.errors)
continue;

auto vx = vd;
if (vd._init && vd._init.isVoidInitializer())
vx = null;
Expand Down
13 changes: 13 additions & 0 deletions test/fail_compilation/diag15340.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
TEST_OUTPUT:
---
fail_compilation/diag15340.d(11): Error: undefined identifier 'undef1'
fail_compilation/diag15340.d(12): Error: undefined identifier 'undef2'
---
*/

class C
{
auto a = undef1;
auto b = undef2;
}