mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4418 from ethereum/initialConstants
Only allow compile-time constants for constant state variables.
This commit is contained in:
@@ -3,4 +3,4 @@ contract C {
|
||||
uint constant y = x();
|
||||
}
|
||||
// ----
|
||||
// Warning: (74-77): Initial value for constant variable has to be compile-time constant. This will fail to compile with the next breaking version change.
|
||||
// TypeError: (74-77): Initial value for constant variable has to be compile-time constant.
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@ contract C {
|
||||
address constant x = msg.sender;
|
||||
}
|
||||
// ----
|
||||
// Warning: (38-48): Initial value for constant variable has to be compile-time constant. This will fail to compile with the next breaking version change.
|
||||
// TypeError: (38-48): Initial value for constant variable has to be compile-time constant.
|
||||
|
||||
Reference in New Issue
Block a user