aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/libsolidity/syntaxTests/specialFunctions/encodePacked_array_of_structs.sol9
-rw-r--r--test/libsolidity/syntaxTests/specialFunctions/encode_array_of_struct.sol10
2 files changed, 19 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/specialFunctions/encodePacked_array_of_structs.sol b/test/libsolidity/syntaxTests/specialFunctions/encodePacked_array_of_structs.sol
new file mode 100644
index 00000000..036e108a
--- /dev/null
+++ b/test/libsolidity/syntaxTests/specialFunctions/encodePacked_array_of_structs.sol
@@ -0,0 +1,9 @@
+contract C {
+ struct S { uint x; }
+ function f() public pure {
+ S[] memory s;
+ abi.encodePacked(s);
+ }
+}
+// ----
+// TypeError: (116-117): This type cannot be encoded.
diff --git a/test/libsolidity/syntaxTests/specialFunctions/encode_array_of_struct.sol b/test/libsolidity/syntaxTests/specialFunctions/encode_array_of_struct.sol
new file mode 100644
index 00000000..7a4d8250
--- /dev/null
+++ b/test/libsolidity/syntaxTests/specialFunctions/encode_array_of_struct.sol
@@ -0,0 +1,10 @@
+pragma experimental ABIEncoderV2;
+contract C {
+ struct S { uint x; }
+ function f() public pure {
+ S[] memory s;
+ abi.encode(s);
+ }
+}
+// ----
+// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.