Merge pull request #11454 from ethereum/data-location-error

Error message: try-catch parameter cannot be in storage.
This commit is contained in:
chriseth 2021-05-31 14:31:01 +02:00 committed by GitHub
commit 6dd5bcd3f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -696,8 +696,7 @@ set<VariableDeclaration::Location> VariableDeclaration::allowedDataLocations() c
if (
isConstructorParameter() ||
isInternalCallableParameter() ||
isLibraryFunctionParameter() ||
isTryCatchParameter()
isLibraryFunctionParameter()
)
locations.insert(Location::Storage);
if (!isTryCatchParameter() && !isConstructorParameter())

View File

@ -0,0 +1,11 @@
contract Foo {
function test() public {
try this.f() {}
catch Error(string reason) {}
}
function f() public {
}
}
// ----
// TypeError 6651: (88-101): Data location must be "memory" for parameter in function, but none was given.