[Issue 11947] New: std.typecons.Proxy incorrectly handles variadic member templates
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jan 19 01:41:18 PST 2014
https://d.puremagic.com/issues/show_bug.cgi?id=11947
Summary: std.typecons.Proxy incorrectly handles variadic member
templates
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: stanislav.blinov at gmail.com
--- Comment #0 from Stanislav Blinov <stanislav.blinov at gmail.com> 2014-01-19 01:41:15 PST ---
When forwarding member function calls, Proxy incorrectly handles cases when
member template is variadic:
import std.typecons : Proxy;
struct RealThing {
void variadic(T...)(T args) {}
}
struct Impostor {
private RealThing p;
mixin Proxy!p;
}
void main()
{
Impostor test;
test.variadic(); // ok
test.variadic("hello"); // error instantiating
}
Proposed solution:
// Original (std.typecons at 3884):
// member template
template opDispatch(T...)
{
auto ref opDispatch(this X, Args...)(auto ref Args args){ return
mixin("a."~name~"!T(args)"); }
}
// Change to (std.typecons at 3884):
// member template
template opDispatch(T...)
{
auto ref opDispatch(this X, Args...)(auto ref Args args)
{
// T is empty, deduction is in effect
static if (Args.length) { return
mixin("a."~name~"!"~Args.stringof~"(args)"); }
// T is explicitly specified
else { return mixin("a."~name~"!T(args)");
}
}
}
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list