solidity
solidity copied to clipboard
`bytes.concat` is not allowed in constant initializers
Description
bytes.concat
does not work when defining constants.
Environment
- Compiler version: 0.8.21
- Target EVM version (as per compiler settings): Hardhat default
- Framework/IDE (e.g. Truffle or Remix): Hardhat
- EVM execution environment / backend / blockchain client: N/A
- Operating system: Ubuntu
Steps to Reproduce
This code compiles:
contract Test {
bytes32 internal constant A = bytes32('a');
bytes32 internal constant B = bytes32('b');
bytes internal constant AB = abi.encodePacked(A, B);
}
This does not:
contract Test {
bytes32 internal constant A = bytes32('a');
bytes32 internal constant B = bytes32('b');
bytes internal constant AB = bytes.concat(A, B);
}