Weird template error message
NaN
divide at by.zero
Fri May 15 22:02:05 UTC 2020
On Friday, 15 May 2020 at 21:55:16 UTC, Paul Backus wrote:
> On Friday, 15 May 2020 at 21:40:20 UTC, NaN wrote:
>> Stripped down example...
>>
>> module test;
>>
>> import std.traits;
>>
>> auto offsetBy(T,F)(T path, F x, F y)
>> {
>> alias PathFloat = TemplateArgsOf!T[0];
>>
>> struct Offseter(Q)
>> {
>> Q path;
>> PathFloat x;
>> PathFloat y;
>> }
>>
>> return Offseter(path, cast(PathFloat) x, cast(PathFloat)
>> y);
>
> This line is the problem. Template argument deduction does not
> work for constructors; you have to write `Offsetter!T(...)`.
Ah OK thanks. Not the most helpful error message from the
compiler lol.
More information about the Digitalmars-d
mailing list