www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - strange bug(?) with attribute inference, need help from volunteers

Hello.

i just tried to compile cbor.d (see announce NG) and found this issue:



(z00.d is just a copypasted sample from README.md)

z00.o: In function 'pure nothrow  nogc  safe void cbor.putChecked!(ubyte[],=
 ubyte).putChecked(ref ubyte[], const(ubyte))':
cbor.d:(.text._D4cbor21__T10putCheckedTAhThZ10putCheckedFNaNbNiNfKAhxhZv+0x=
a): undefined reference to 'pure nothrow  nogc  safe void std.range.primiti=
ves.put!(ubyte[], const(ubyte)).put(ref ubyte[], const(ubyte))'
z00.o: In function `_D4cbor22__T10putCheckedTAhTAhZ10putCheckedFNaNbNiNfKAh=
xAhZv':
cbor.d:(.text._D4cbor22__T10putCheckedTAhTAhZ10putCheckedFNaNbNiNfKAhxAhZv+=
0xd): undefined reference to 'pure nothrow  nogc  safe void std.range.primi=
tives.put!(ubyte[], const(ubyte)[]).put(ref ubyte[], const(ubyte)[])'
z00.o: In function `_D4cbor22__T10putCheckedTAhTAhZ10putCheckedFNaNbNiNfKAh=
KxAhZv':
cbor.d:(.text._D4cbor22__T10putCheckedTAhTAhZ10putCheckedFNaNbNiNfKAhKxAhZv=
+0xf): undefined reference to 'pure nothrow  nogc  safe void std.range.prim=
itives.put!(ubyte[], const(ubyte)[]).put(ref ubyte[], const(ubyte)[])'

sorry for the linenoise, but i think it is decipherable. i demangled
names for clarity.

seems that dmd somehow decides that `cbor.putChecked` is pure, and
couldn't find pure `put` for ranges (which is obvious; what use of pure
`put` can be? ;-).

but if i do this:




everything is fine and i got working `z00` binary.

i tried to dustmite that, but got complete garbage (as dustmite loves
to produce ;-). seems that this is a bug in attributes inference, but i
unable to minify it to something sane. maybe somebody brave enough can
write a sane sample which triggers this bug?


system: dmd from git head without any custom patches, GNU/Linux, x86.
Dec 19 2014