Skip to content

Conversion error for ulong -> uint (as a size_t) on 32-bit linux  #4

@PiotrekDlang

Description

@PiotrekDlang

What is current policy for dealing with ulong -> size_t conversion?

dmd -main -unittest allocator.d

allocator.d(2015): Error: cannot implicitly convert expression (i * 4096LU) of type ulong to uint
allocator.d(2015): Error: cannot implicitly convert expression ((i + cast(ulong)blocks) * 4096LU) of type ulong to uint
allocator.d(1743): Error: template instance std.allocator.HeapBlock!(4096u, 4u)
allocator.d(331): instantiated from here: HeapBlock!(4096u, 4u)
allocator.d(334): Error: template instance Segregator!
allocator.d(2015): Error: cannot implicitly convert expression (i * 128LU) of type ulong to uint
allocator.d(2015): Error: cannot implicitly convert expression ((i + cast(ulong)blocks) * 128LU) of type ulong to uint
allocator.d(1743): Error: template instance std.allocator.HeapBlock!(128u, 4u)
allocator.d(1342): instantiated from here: HeapBlock!(128u, 4u)
allocator.d(1493): Error: cannot implicitly convert expression (x / 64LU) of type ulong to immutable(uint)
allocator.d(1495): Error: cannot implicitly convert expression (y / 64LU) of type ulong to immutable(uint)
allocator.d(1520): Error: cannot implicitly convert expression (x / 64LU) of type ulong to uint
allocator.d(1526): Error: cannot implicitly convert expression (i) of type ulong to uint
allocator.d(1527): Error: cannot implicitly convert expression (i) of type ulong to uint
allocator.d(1544): Error: cannot implicitly convert expression (w) of type ulong to uint
allocator.d(1553): Error: cannot implicitly convert expression (w) of type ulong to uint
allocator.d(1572): Error: cannot implicitly convert expression (w) of type ulong to uint
allocator.d(1582): Error: cannot implicitly convert expression (w) of type ulong to uint
allocator.d(1607): Error: cannot implicitly convert expression (i) of type ulong to uint
allocator.d(1615): Error: cannot implicitly convert expression (i) of type ulong to uint
allocator.d(1627): Error: cannot implicitly convert expression (i) of type ulong to uint
allocator.d(1633): Error: cannot implicitly convert expression (i) of type ulong to uint
allocator.d(4143): Error: function std.allocator.roundUpToMultipleOf (uint s, uint base) is not
callable using argument types (ulong, uint)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions