Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/func.d
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,15 @@ public:
localsymtab = new DsymbolTable();
// Establish function scope
auto ss = new ScopeDsymbol();
ss.parent = sc.scopesym;
// find enclosing scope symbol, might skip symbol-less CTFE and/or FuncExp scopes
for (auto scx = sc; ; scx = scx.enclosing)
{
if (scx.scopesym)
{
ss.parent = scx.scopesym;
break;
}
}
Scope* sc2 = sc.push(ss);
sc2.func = this;
sc2.parent = this;
Expand Down
3 changes: 3 additions & 0 deletions test/compilable/imports/imp16460.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module imports.imp16460;

package enum val = 0;
13 changes: 13 additions & 0 deletions test/compilable/test16460.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module imports.test16460;

void bug()
{
auto d1 = (){
import imports.imp16460;
return val;
};
enum d2 = (){
import imports.imp16460;
return val;
};
}