aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/syntaxTests/constants
diff options
context:
space:
mode:
Diffstat (limited to 'test/libsolidity/syntaxTests/constants')
-rw-r--r--test/libsolidity/syntaxTests/constants/assign_constant_function_value.sol6
-rw-r--r--test/libsolidity/syntaxTests/constants/assign_constant_function_value_050.sol8
2 files changed, 14 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/constants/assign_constant_function_value.sol b/test/libsolidity/syntaxTests/constants/assign_constant_function_value.sol
new file mode 100644
index 00000000..88e94e29
--- /dev/null
+++ b/test/libsolidity/syntaxTests/constants/assign_constant_function_value.sol
@@ -0,0 +1,6 @@
+contract C {
+ function () pure returns (uint) x;
+ 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.
diff --git a/test/libsolidity/syntaxTests/constants/assign_constant_function_value_050.sol b/test/libsolidity/syntaxTests/constants/assign_constant_function_value_050.sol
new file mode 100644
index 00000000..2c92899d
--- /dev/null
+++ b/test/libsolidity/syntaxTests/constants/assign_constant_function_value_050.sol
@@ -0,0 +1,8 @@
+pragma experimental "v0.5.0";
+
+contract C {
+ function () pure returns (uint) x;
+ uint constant y = x();
+}
+// ----
+// TypeError: (105-108): Initial value for constant variable has to be compile-time constant.