Merge pull request #4418 from ethereum/initialConstants

Only allow compile-time constants for constant state variables.
This commit is contained in:
chriseth
2018-07-05 17:07:32 +02:00
committed by GitHub
4 changed files with 7 additions and 15 deletions
@@ -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.
@@ -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.