Bug 20717 – Unsilenced bogus "undefined identifier" error from speculative collision

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-04-01T03:23:02Z
Last change time
2022-04-01T09:50:40Z
Keywords
pull, rejects-valid
Assigned to
No Owner
Creator
Vladimir Panteleev

Attachments

IDFilenameSummaryContent-TypeSize
1779issue20717.patchworkaroundtext/plain888

Comments

Comment #0 by dlang-bugzilla — 2020-04-01T03:23:02Z
//////// test.d //////// pragma(msg, is(typeof({ struct S { struct Foo {} struct Bar() {} alias Bar = Foo; } }))); //////////////////////// Compiler output: test.d(5): Error: undefined identifier `Foo` false Introduced in https://github.com/dlang/dmd/pull/10078
Comment #1 by b2.temp — 2020-04-03T17:01:00Z
The problem is that the semantic of the alias is run at the wrong time, i.e the error are not gagged but in the present context they should. The gagging is activated when the IsExp is visited. But the alias sema is run when the overload is inserted.
Comment #2 by b2.temp — 2020-04-03T17:05:28Z
Created attachment 1779 workaround As officially I dont participate to dlang anymore but also as a commit of mine causes the regression I send a patch. The fix is not really good but comes with explanations about what was done in first place, i.e for issue 15795. Ideally issue 15795 should be fixed in another way but I remember that I could not find a better way when I made the PR.
Comment #3 by b2.temp — 2020-04-03T17:33:01Z
good news, this problem is fixed by https://github.com/dlang/dmd/pull/10952/
Comment #4 by boris2.9 — 2020-04-04T10:03:27Z
I just checked the problem is still there.
Comment #5 by b2.temp — 2020-04-04T11:26:57Z
indeed, the patch I sent (workaround) was still applied.
Comment #6 by b2.temp — 2020-04-04T11:30:31Z
Ok I've find what really happens. When you merge the two tests in a single module, so the one reported here and the one here https://github.com/dlang/dmd/pull/10078/files#diff-b33aefca6dc2d2014d789a2d8727fb1eR1, then this compiles because symbols are solved differently.
Comment #7 by dlang-bot — 2022-03-29T14:37:41Z
@RazvanN7 created dlang/dmd pull request #13922 "Fix Issue 20717 - Unsilenced bogus undefined identifier error from speculative collision" fixing this issue: - Fix Issue 20717 - Unsilenced bogus undefined identifier error from speculative collision https://github.com/dlang/dmd/pull/13922
Comment #8 by dlang-bot — 2022-03-30T04:32:00Z
dlang/dmd pull request #13922 "Fix Issue 20717 - Unsilenced bogus undefined identifier error from speculative collision" was merged into stable: - f197f62417da1926e2846a6e2b44b5cbe8934875 by RazvanN7: Fix Issue 20717 - Unsilenced bogus undefined identifier error from speculative collision https://github.com/dlang/dmd/pull/13922
Comment #9 by dlang-bot — 2022-04-01T09:50:40Z
dlang/dmd pull request #13937 "merge stable" was merged into master: - 7d6cc698eba28962d098f4c527d9e1a5371b0a19 by RazvanN7: Fix Issue 20717 - Unsilenced bogus undefined identifier error from speculative collision https://github.com/dlang/dmd/pull/13937