Checked!({short, ushort, byte, ubyte}, Throw): compilation fails
kdevel
kdevel at vogtner.de
Fri Apr 17 08:59:19 UTC 2020
On Friday, 17 April 2020 at 04:29:06 UTC, Meta wrote:
> Unlike C/C++, char is not a numeric type in D; It's a UTF-8
> code point:
Thanks, it's a code /unit/. main reads now:
void main ()
{
bar!ubyte;
bar!byte;
bar!ushort;
bar!short;
bar!uint;
bar!int;
bar!ulong;
bar!long;
}
and dmd complains:
[...]linux/bin64/../../src/phobos/std/experimental/checkedint.d(1410): Deprecation: integral promotion not done for `~cast(ubyte)0u`, use '-preview=intpromote' switch or `~cast(int)(cast(ubyte)0u)`
x.d(9): Error: template
`std.experimental.checkedint.Checked!(ubyte,
Throw).Checked.__ctor` cannot deduce function from argument types
`!()(Checked!(int, Throw))`, candidates are:
[...]linux/bin64/../../src/phobos/std/experimental/checkedint.d(331): `__ctor(U)(U rhs)`
x.d(15): Error: template instance `x.foo!ubyte` error
instantiating
x.d(22): instantiated from here: `bar!ubyte`
[...]linux/bin64/../../src/phobos/std/experimental/checkedint.d(1410): Deprecation: integral promotion not done for `~cast(byte)0`, use '-preview=intpromote' switch or `~cast(int)(cast(byte)0)`
x.d(9): Error: template
`std.experimental.checkedint.Checked!(byte,
Throw).Checked.__ctor` cannot deduce function from argument types
`!()(Checked!(int, Throw))`, candidates are:
[...]linux/bin64/../../src/phobos/std/experimental/checkedint.d(331): `__ctor(U)(U rhs)`
x.d(15): Error: template instance `x.foo!byte` error instantiating
x.d(23): instantiated from here: `bar!byte`
[...]linux/bin64/../../src/phobos/std/experimental/checkedint.d(1410): Deprecation: integral promotion not done for `~cast(ushort)0u`, use '-preview=intpromote' switch or `~cast(int)(cast(ushort)0u)`
x.d(9): Error: template
`std.experimental.checkedint.Checked!(ushort,
Throw).Checked.__ctor` cannot deduce function from argument types
`!()(Checked!(int, Throw))`, candidates are:
[...]linux/bin64/../../src/phobos/std/experimental/checkedint.d(331): `__ctor(U)(U rhs)`
x.d(15): Error: template instance `x.foo!ushort` error
instantiating
x.d(24): instantiated from here: `bar!ushort`
[...]linux/bin64/../../src/phobos/std/experimental/checkedint.d(1410): Deprecation: integral promotion not done for `~cast(short)0`, use '-preview=intpromote' switch or `~cast(int)(cast(short)0)`
x.d(9): Error: template
`std.experimental.checkedint.Checked!(short,
Throw).Checked.__ctor` cannot deduce function from argument types
`!()(Checked!(int, Throw))`, candidates are:
[...]linux/bin64/../../src/phobos/std/experimental/checkedint.d(331): `__ctor(U)(U rhs)`
x.d(15): Error: template instance `x.foo!short` error
instantiating
x.d(25): instantiated from here: `bar!short`
I tested some DMD versions down to 2.075 none of which compiled
successfully.
More information about the Digitalmars-d-learn
mailing list