2

I am compiling using sol 0.8.0 and the following line is producing the error in the title:

uint256 public constant MASK = uint128(~0);

Error:

Explicit type conversion not allowed from "int_const -1" to "uint128".

When changing the variable to this:

uint256 public constant MASK = ~0;

The error changes to:

Type int_const -1 is not implicitly convertible to expected type uint256. Cannot implicitly convert signed literal to unsigned type.
4

Changed it to this:

uint256 public constant MASK = type(uint128).max;

New restrictions in 0.8.0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.