http://d.puremagic.com/issues/show_bug.cgi?id=11099
Summary: Diagnostic for mixed-in symbols should not reference
the mixin template
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: diagnostic
Severity: enhancement
Priority: P2
Component: druntime
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Andrej Mitrovic <[email protected]> 2013-09-22
07:19:02 PDT ---
-----
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.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------