mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Still allow empty structs for non-0.5.0 mode
This commit is contained in:
parent
b540ba527a
commit
ebb12756ad
@ -3,6 +3,7 @@
|
||||
Features:
|
||||
* General: Support accessing dynamic return data in post-byzantium EVMs.
|
||||
* Interfaces: Allow overriding external functions in interfaces with public in an implementing contract.
|
||||
* Syntax Checker: Issue warning for empty structs (or error as experimental 0.5.0 feature).
|
||||
|
||||
Bugfixes:
|
||||
* Code Generator: Allow ``block.blockhash`` without being called.
|
||||
@ -12,7 +13,6 @@ Bugfixes:
|
||||
* Commandline interface: Support ``--evm-version constantinople`` properly.
|
||||
* DocString Parser: Fix error message for empty descriptions.
|
||||
* Standard JSON: Support ``constantinople`` as ``evmVersion`` properly.
|
||||
* Syntax Checker: Issue error for empty structs.
|
||||
* Type System: Make external library functions accessible.
|
||||
|
||||
### 0.4.21 (2018-03-07)
|
||||
|
@ -258,7 +258,14 @@ bool SyntaxChecker::visit(VariableDeclaration const& _declaration)
|
||||
|
||||
bool SyntaxChecker::visit(StructDefinition const& _struct)
|
||||
{
|
||||
bool const v050 = m_sourceUnit->annotation().experimentalFeatures.count(ExperimentalFeature::V050);
|
||||
|
||||
if (_struct.members().empty())
|
||||
m_errorReporter.syntaxError(_struct.location(), "Defining empty structs is disallowed.");
|
||||
{
|
||||
if (v050)
|
||||
m_errorReporter.syntaxError(_struct.location(), "Defining empty structs is disallowed.");
|
||||
else
|
||||
m_errorReporter.warning(_struct.location(), "Defining empty structs is deprecated.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -2,4 +2,4 @@ contract test {
|
||||
struct A {}
|
||||
}
|
||||
// ----
|
||||
// SyntaxError: Defining empty structs is disallowed.
|
||||
// Warning: Defining empty structs is deprecated.
|
||||
|
6
test/libsolidity/syntaxTests/empty_struct_050.sol
Normal file
6
test/libsolidity/syntaxTests/empty_struct_050.sol
Normal file
@ -0,0 +1,6 @@
|
||||
pragma experimental "v0.5.0";
|
||||
contract test {
|
||||
struct A {}
|
||||
}
|
||||
// ----
|
||||
// SyntaxError: Defining empty structs is disallowed.
|
Loading…
Reference in New Issue
Block a user