-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Closed as not planned
Labels
closed due inactivityThe issue/PR was automatically closed due to inactivity.The issue/PR was automatically closed due to inactivity.language design
Any changes to the language, e.g. new featuresAny changes to the language, e.g. new featuresstaleThe issue/PR was marked as stale because it has been open for too long.The issue/PR was marked as stale because it has been open for too long.

Description
Description
Enum max values can't be used to dimension an array.
An enum max value can be assigned to a constant. But that constant can't be used as an array size.
'Normal' constants can be used to dimension an array.
See example below.
Environment
- Compiler version: 0.8.13
- Target EVM version (as per compiler settings): default
- Framework/IDE (e.g. Truffle or Remix): Remix
- EVM execution environment / backend / blockchain client:
- Operating system: Windows
Steps to Reproduce
//SPDX-License-Identifier: MIT
pragma solidity 0.8.13;
contract test {
enum ParameterIndexes { P1,P2 }
uint constant x1 = uint(type(ParameterIndexes).max);
uint256[x1] params1; // Doesn't compile: Error expected integer literal or constant expression
uint256[uint(type(ParameterIndexes).max)] params2; // Doesn't compile: Error expected integer literal or constant expression
uint constant x2 = 7;
uint256[x2] params3; // Does compile
}
Metadata
Metadata
Assignees
Labels
closed due inactivityThe issue/PR was automatically closed due to inactivity.The issue/PR was automatically closed due to inactivity.language design
Any changes to the language, e.g. new featuresAny changes to the language, e.g. new featuresstaleThe issue/PR was marked as stale because it has been open for too long.The issue/PR was marked as stale because it has been open for too long.
