TVM-Solidity-Compiler icon indicating copy to clipboard operation
TVM-Solidity-Compiler copied to clipboard

contract constructor can't be external

Open cryshado opened this issue 2 years ago • 1 comments

When I try to compile the following code:

pragma ton-solidity >=0.59.4;

contract Test {
    constructor() external internalMsg { }
}   

I get an error: Error: Constructor must be public or internal. I want to allow deploy my smart contract by internal message without making the constructor call available inside the contract, but I can't do that. I think this seems to be an issue.

cryshado avatar May 25 '22 20:05 cryshado

The constructor cannot be explicitly "called" from within the contract hence no need for external modifier. Furthermore, external keyword on constructors causes issues with inheritance.

webala avatar May 27 '22 00:05 webala