-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Labels
Description
With the advent of #3526 in solidity 0.4.22, it would appear that the new constructor keyword stops you having both an empty constructor and a fallback function in the same contract.
Given the following code, contract A will complain that the constructor and fallback have the same name and arguments.
pragma solidity ^0.4.22;
contract A {
address owner;
constructor () internal {
owner = msg.sender;
}
function () payable {
revert();
}
}
contract B is A {
uint supply;
constructor () public {
supply = 10 ether;
}
}This is the error returned:
test.sol:6:5: DeclarationError: Function with same name and arguments defined twice.
constructor () internal {
^ (Relevant source part starts here and spans across multiple lines).
test.sol:10:5: Other declaration is here:
function () payable {
^ (Relevant source part starts here and spans across multiple lines).
Reactions are currently unavailable