From ebb12756adfe95ae694ed7e141890c6d47e8b7b4 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 27 Mar 2018 15:00:33 +0100 Subject: Still allow empty structs for non-0.5.0 mode --- libsolidity/analysis/SyntaxChecker.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libsolidity/analysis/SyntaxChecker.cpp') diff --git a/libsolidity/analysis/SyntaxChecker.cpp b/libsolidity/analysis/SyntaxChecker.cpp index e03417a9..3a32810b 100644 --- a/libsolidity/analysis/SyntaxChecker.cpp +++ b/libsolidity/analysis/SyntaxChecker.cpp @@ -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; } -- cgit