_This issue is being reported as part of the current audit being held by Zeppelin Solutions to Solidity's compiler (tag v0.4.24)._
Compiler crashes when using a struct as a parameter for an external function, with pragma experimental ABIEncoderv2.
Empty message.
libsolidity/codegen/ABIFunctions.cpp(1268)
Unimplemented feature.
Throw in function std::__cxx11::string dev::solidity::ABIFunctions::abiDecodingFunctionStruct(const dev::solidity::StructType&, bool)
pragma experimental ABIEncoderV2;
pragma solidity ^0.4.24;
library Test {
struct Nested { }
function Y(Nested a) external {}
}
In this form this is now longer allowed in 0.5.0:
4714.sol:5:4: Error: Defining empty structs is disallowed.
struct Nested { }
^---------------^
Adding a member (uint a;) to the struct still produces the unimplemented feature exception:
Unimplemented feature:
/Users/alex/Projects/solidity/libsolidity/codegen/ABIFunctions.cpp(1268): Throw in function std::__1::string dev::solidity::ABIFunctions::abiDecodingFunctionStruct(const dev::solidity::StructType &, bool)
Dynamic exception type: boost::exception_detail::clone_impl<dev::solidity::UnimplementedFeatureError>
std::exception::what:
[dev::tag_comment*] =
The problem here is that calldata encoding for structs isn't defined yet in the encoder and external forces that. Using public will make it work because then it is handled internally as encoding from memory.
There must be an issue tracking this already.
@mattaereal yes, this is basically the unticked box in #1603
pragma experimental ABIEncoderV2;
pragma solidity ^0.4.24;
library Test {
struct Nested { int i; }
function Y(Nested storage a) external { a.i = 42; }
}
@axic compiles fine on latest develop.
edit: same here as in #4713; it got fixed implicitly via #4738.
Closing since the crash is fixed.