Function template arg promotion

Timon Gehr timon.gehr at gmx.ch
Fri Feb 3 15:43:30 PST 2012


On 02/03/2012 04:10 PM, Artur Skawina wrote:
> ------------------------------------------------------------------------
> void set_from_4ub_f(ubyte red, ubyte green, ubyte blue, ubyte alpha) { }
> void set_from_4ub()(ubyte red, ubyte green, ubyte blue, ubyte alpha) { }
>
> void f() {
>     set_from_4ub_f(0x00, 0x00, 0x00, 0xff); // Works.
>     set_from_4ub(0x00, 0x00, 0x00, 0xff);   // Fails.
> }
> ------------------------------------------------------------------------
>
> results in:
>
> templargpromo.d:6: Error: template templargpromo.set_from_4ub() does not match any function template declaration
> templargpromo.d:6: Error: template templargpromo.set_from_4ub() cannot deduce template function from argument types !()(int,int,int,int)
>
>
> Any way to make the template version work, without requiring changes for users?
> And without having to cast the args back to ubyte before using them?
>
> artur

It should already work. It is a bug, probably related to
http://d.puremagic.com/issues/show_bug.cgi?id=7366


More information about the Digitalmars-d mailing list