Bug 11099 – Diagnostic for mixed-in symbols should not reference the mixin template

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-22T07:19:02Z
Last change time
2024-12-13T18:11:45Z
Keywords
diagnostic
Assigned to
No Owner
Creator
Andrej Mitrovic
Moved to GitHub: dmd#17612 →

Comments

Comment #0 by andrej.mitrovich — 2013-09-22T07:19:02Z
----- mixin template Helpers(int x) { @disable void foo() { } } struct S { mixin Helpers!16; } void main() { S s; s.foo(); } ----- $ dmd test.d test.d(14): Error: function test.S.Helpers!16.foo is not callable because it is annotated with @disable Because of these diagnostics using a template mixin introduces a really bad user experience. The user shouldn't have to know that a struct implements a function using a mixin template. The diagnostic should be: ----- test.d(14): Error: function test.S.foo is not callable because it is annotated with @disable ----- Currently we're forced to use string mixins to achieve the same effect: ----- string Helpers(int x)() { return q{ @disable void foo() { } }; } struct S { mixin(Helpers!16()); } void main() { S s; s.foo(); } ----- $ dmd test.d test.d(16): Error: function test.S.foo is not callable because it is annotated with @disable But mixin templates are supposed to be used exactly for this purpose, for mixing in declarations rather than arbitrary code.
Comment #1 by robert.schadek — 2024-12-13T18:11:45Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17612 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB