Skip to content

Quantity.opBinary not working when called from a const function. #3

@LiamM32

Description

@LiamM32

Here is my function where I got this error:

    Millimolar getConcentration(Compound chemical) const {
        return (ligandLevels[chemical].inBody / body.bloodVolume);
    }

I got the following error:

Error: incompatible types for `(this.ligandLevels[chemical].inBody) / (this.body.bloodVolume)`: `const(Quantity!(PrefixedUnit!(BaseUnit!("mole", "mol"), -3, __T12PrefixSystemVli10S_D12experimental5units2si10__lambda53FNaNbNfZASQBtQBi6PrefixZ), float))` and `const(Quantity!(BaseUnit!("litre", "L"), float))`

Removing the const attribute of this function results in the error disappearing.

This should be resolved so that arithmetic on Quantity values can be done in constant functions.

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