Bug 23686 – template instance reused with default alias arg

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-02-11T13:19:08Z
Last change time
2023-11-01T22:39:22Z
Keywords
accepts-invalid, pull
Assigned to
No Owner
Creator
Adam D. Ruppe

Comments

Comment #0 by destructionator — 2023-02-11T13:19:08Z
``` void FNfoo() {} void load(string name, alias T = mixin("FN" ~ name))() {} void main() { load!"foo"(); load!"wtf"(); } ``` Compiles without error even though FNwtf does not exist. Smells similar to https://issues.dlang.org/show_bug.cgi?id=12533 and https://issues.dlang.org/show_bug.cgi?id=14501
Comment #1 by dlang-bot — 2023-10-14T00:03:44Z
@SixthDot created dlang/dmd pull request #15679 "fix issue 23686 - TemplateAliasParam default value possibly considere…" fixing this issue: - fix issue 23686 - TemplateAliasParam default value possibly considered equal in different instances The default arg might depend on another TemplateParameter, in which case it is required to copy the AST, otherwise different instances of the template might be falsy considered equal. https://github.com/dlang/dmd/pull/15679
Comment #2 by dlang-bot — 2023-10-14T10:12:35Z
@SixthDot updated dlang/dmd pull request #15681 "fix issue 23865 - ICE on attempt to insert an non overloadable symbol…" fixing this issue: - fix issue 23686 - TemplateAliasParam default value possibly considered equal in different instances (#15679) The default arg might depend on another TemplateParameter, in which case it is required to copy the AST, otherwise different instances of the template might be falsy considered equal. https://github.com/dlang/dmd/pull/15681
Comment #3 by dlang-bot — 2023-11-01T22:39:22Z
dlang/dmd pull request #15771 "merge stable" was merged into master: - 26f706a9ddc760d585e4c0eb9d18dc354158426c by SixthDot: fix issue 23686 - TemplateAliasParam default value possibly considered equal in different instances (#15679) The default arg might depend on another TemplateParameter, in which case it is required to copy the AST, otherwise different instances of the template might be falsy considered equal. https://github.com/dlang/dmd/pull/15771