This compiles fine for me locally. There’s something very weird going on. Are you 100% sure that this is the exact code you are compiling? Maybe you could post the AST the compiler sees. If it’s somehow compiling a different source file, this will make it apparent:
solc ./contracts/MySmartContract.sol --ast
I wonder if it might be because of snap. Since your solc is running inside it and you’re giving it a relative path, it might actually be compiling an entirely different file that’s located somewhere in its working directory.
By the way, I’d recommend not using snap to install the compiler anyway. From what I can see at snapcraft.io/solc it marks 0.5.16 as “stable” even though it’s ancient. There’s 0.6.8 “beta” but that’s quite old too. The snap page has not been updated in over a year. We’re at 0.8.6 now and that’s what I’d recommend using unless you have an older contract that you cannot upgrade. You can get up to date compiler binaries from solc-bin. It does not make all that much sense to use something like snap for it since the compiler is a single binary that you can just download and run.