mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6080 from ethereum/library-index-access
Disallow index access on contracts and libraries
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
contract C {
|
||||
C[] y = new C[](3);
|
||||
C[3] x;
|
||||
function f() public {
|
||||
C[3] memory z;
|
||||
y.push(this);
|
||||
x[0] = this;
|
||||
z[0] = this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() view public {
|
||||
C[0];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (52-56): Index access for contracts or libraries is not possible.
|
||||
@@ -0,0 +1,7 @@
|
||||
library C {
|
||||
function f() view public {
|
||||
C[0];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (51-55): Index access for contracts or libraries is not possible.
|
||||
Reference in New Issue
Block a user