Skip to content

Commit

Permalink
Merge pull request #5270 from 9rnsr/fix15340
Browse files Browse the repository at this point in the history
Issue 15340 - Spurious "overlapped default initialization" errors with auto fields
  • Loading branch information
AndrejMitrovic committed Nov 15, 2015
2 parents ccadd00 + 528cf6a commit b15e6c4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/aggregate.d
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
@@ -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;
}

0 comments on commit b15e6c4

Please sign in to comment.