On Thursday, 12 May 2016 at 00:04:43 UTC, Adam D. Ruppe wrote:
On Wednesday, 11 May 2016 at 23:46:48 UTC, John Colvin wrote:
Bug? Or am I misunderstanding how these two features are
supposed to interact?
I'm not sure what you actually expected there, but I'd note
that in general, opDispatch
On Wednesday, 11 May 2016 at 23:46:48 UTC, John Colvin wrote:
Bug? Or am I misunderstanding how these two features are
supposed to interact?
I'm not sure what you actually expected there, but I'd note that
in general, opDispatch will always be preferred over UFCS, just
like any other member
struct S
{
int a;
template opDispatch(string s)
{
template opDispatch(T...)
{
auto ref opDispatch(Args ...)(auto ref Args args)
{
return S(mixin(`a.` ~ s ~ (T.length ? `!T` : ``)
~ `(args)`));
}
}
}
}
a template
}
Should the constraint on opDispatch allow the UFCS to call on S?
To avoid this kind of issues:
struct S {
template opDispatch(string s) if (s.startsWith(foo)) {
void opDispatch(T...)(T t) {
writeln(s);
}
}
}
And, yes, the compiler
On Tuesday, 2 July 2013 at 11:04:20 UTC, Artur Skawina wrote:
To avoid this kind of issues:
struct S {
template opDispatch(string s) if (s.startsWith(foo)) {
void opDispatch(T...)(T t) {
writeln(s);
}
}
}
That's a handy workaround,
!(to) isn't
a template
}
Should the constraint on opDispatch allow the UFCS to call on
S?
That's a compiler bug.
http://d.puremagic.com/issues/show_bug.cgi?id=10526
Kenji Hara
on opDispatch allow the UFCS to call on S?