mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge pull request #3484 from federicobond/fix-segfault
Fix segfault with undeclared array types
This commit is contained in:
		
						commit
						49d867d27b
					
				| @ -153,6 +153,11 @@ void ReferencesResolver::endVisit(Mapping const& _typeName) | ||||
| void ReferencesResolver::endVisit(ArrayTypeName const& _typeName) | ||||
| { | ||||
| 	TypePointer baseType = _typeName.baseType().annotation().type; | ||||
| 	if (!baseType) | ||||
| 	{ | ||||
| 		solAssert(!m_errorReporter.errors().empty(), ""); | ||||
| 		return; | ||||
| 	} | ||||
| 	if (baseType->storageBytes() == 0) | ||||
| 		fatalTypeError(_typeName.baseType().location(), "Illegal base type of storage size zero for array."); | ||||
| 	if (Expression const* length = _typeName.length()) | ||||
|  | ||||
| @ -2196,6 +2196,16 @@ BOOST_AUTO_TEST_CASE(array_copy_with_different_types_dynamic_static) | ||||
| 	CHECK_ERROR(text, TypeError, "Type uint256[] storage ref is not implicitly convertible to expected type uint256[80] storage ref."); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(array_of_undeclared_type) | ||||
| { | ||||
| 	char const* text = R"( | ||||
| 		contract c { | ||||
| 			a[] public foo; | ||||
| 		} | ||||
| 	)"; | ||||
| 	CHECK_ERROR(text, DeclarationError, "Identifier not found or not unique."); | ||||
| } | ||||
| 
 | ||||
| BOOST_AUTO_TEST_CASE(storage_variable_initialization_with_incorrect_type_int) | ||||
| { | ||||
| 	char const* text = R"( | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user