mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix .push() not considering external functions
This commit is contained in:
parent
a07b3ec70f
commit
89d6bff72a
@ -13,6 +13,7 @@ Bugfixes:
|
|||||||
* Antlr Grammar: Allow builtin names in ``yulPath`` to support ``.address`` in function pointers.
|
* Antlr Grammar: Allow builtin names in ``yulPath`` to support ``.address`` in function pointers.
|
||||||
* Control Flow Graph: Perform proper virtual lookup for modifiers for uninitialized variable and unreachable code analysis.
|
* Control Flow Graph: Perform proper virtual lookup for modifiers for uninitialized variable and unreachable code analysis.
|
||||||
* Immutables: Fix wrong error when the constructor of a base contract uses ``return`` and the parent contract contains immutable variables.
|
* Immutables: Fix wrong error when the constructor of a base contract uses ``return`` and the parent contract contains immutable variables.
|
||||||
|
* IR Generator: Fix IR syntax error when copying storage arrays of structs containing functions.
|
||||||
* Natspec: Fix ICE when overriding a struct getter with a Natspec-documented return value and the name in the struct is different.
|
* Natspec: Fix ICE when overriding a struct getter with a Natspec-documented return value and the name in the struct is different.
|
||||||
* TypeChecker: Fix ICE when a constant variable declaration forward references a struct.
|
* TypeChecker: Fix ICE when a constant variable declaration forward references a struct.
|
||||||
|
|
||||||
|
@ -3608,7 +3608,7 @@ string YulUtilFunctions::copyStructToStorageFunction(StructType const& _from, St
|
|||||||
auto const& [srcSlotOffset, srcOffset] = _from.storageOffsetsOfMember(structMembers[i].name);
|
auto const& [srcSlotOffset, srcOffset] = _from.storageOffsetsOfMember(structMembers[i].name);
|
||||||
t("memberOffset", formatNumber(srcSlotOffset));
|
t("memberOffset", formatNumber(srcSlotOffset));
|
||||||
if (memberType.isValueType())
|
if (memberType.isValueType())
|
||||||
t("read", readFromStorageValueType(memberType, srcOffset, false));
|
t("read", readFromStorageValueType(memberType, srcOffset, true));
|
||||||
else
|
else
|
||||||
solAssert(srcOffset == 0, "");
|
solAssert(srcOffset == 0, "");
|
||||||
|
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
contract C {
|
||||||
|
struct Struct {
|
||||||
|
function () external el;
|
||||||
|
}
|
||||||
|
Struct[] array;
|
||||||
|
int externalCalled = 0;
|
||||||
|
|
||||||
|
function ext() external {
|
||||||
|
externalCalled++;
|
||||||
|
}
|
||||||
|
|
||||||
|
function f() public {
|
||||||
|
array.push(Struct(this.ext));
|
||||||
|
array.push(array[0]);
|
||||||
|
|
||||||
|
array[0].el();
|
||||||
|
array[1].el();
|
||||||
|
|
||||||
|
assert(externalCalled == 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ====
|
||||||
|
// compileViaYul: also
|
||||||
|
// ----
|
||||||
|
// f() ->
|
||||||
|
// gas irOptimized: 113142
|
||||||
|
// gas legacy: 112937
|
||||||
|
// gas legacyOptimized: 112608
|
Loading…
Reference in New Issue
Block a user