Still allow empty structs for non-0.5.0 mode

This commit is contained in:
Alex Beregszaszi
2018-03-27 15:49:41 +01:00
parent b540ba527a
commit ebb12756ad
4 changed files with 16 additions and 3 deletions
+8 -1
View File
@@ -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;
}