Bug 22685 – Template function instantiated with lambda and overload is nested incorrectly

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2022-01-17T16:51:00Z
Last change time
2022-01-20T12:02:17Z
Keywords
pull
Assigned to
No Owner
Creator
FeepingCreature

Comments

Comment #0 by default_357-line — 2022-01-17T16:51:00Z
Consider the following code ( https://run.dlang.io/is/jJvVDN ): --- a.d import b; void main() { twoArgs!(a => 1, overloaded); } --- b.d import c : overloaded; void twoArgs(alias a, alias b)() { } void overloaded()() { } --- c.d void overloaded()() { } When calling dmd a.d, you get the remarkable a.d(5): Error: template instance `twoArgs!((a) => 1, overloaded)` `twoArgs!((a) => 1, overloaded)` is nested in both `main` and `b`
Comment #1 by moonlightsentinel — 2022-01-17T21:39:37Z
The segfault was introduced by https://github.com/dlang/dmd/pull/12595, but the underlying issue is the construction of a `TypeDelegate` from a `TypeErrror`
Comment #2 by moonlightsentinel — 2022-01-17T21:40:00Z
(In reply to moonlightsentinel from comment #1) > The segfault was introduced by https://github.com/dlang/dmd/pull/12595, but > the underlying issue is the construction of a `TypeDelegate` from a > `TypeErrror` Please ignore this, wrong issue
Comment #3 by dlang-bot — 2022-01-20T10:23:48Z
@FeepingCreature created dlang/dmd pull request #13554 "Fix issue 22685: Symbol nested in both function and module? Not a problem." fixing this issue: - Fix issue 22685: When finding template argument context for creating a nested instance, ignore symbols in modules. Symbols in modules can be used regardless of runtime context. https://github.com/dlang/dmd/pull/13554
Comment #4 by dlang-bot — 2022-01-20T12:02:17Z
dlang/dmd pull request #13554 "Fix issue 22685: Symbol nested in both function and module? Not a problem." was merged into master: - a40bbcae2168b757b0953f1aa6d95cabf12ee1e6 by Mathis Beer: Fix issue 22685: When finding template argument context for creating a nested instance, ignore symbols in modules. Symbols in modules can be used regardless of runtime context. https://github.com/dlang/dmd/pull/13554