ICE in `StructType::isDynamicallyEncoded` when a struct member is a function type with a `calldata` return
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 21
Description
The compiler panics with `Solidity assertion failed` in [`libsolidity/ast/Types.cpp:2295`](https://github.com/ethereum/solidity/blob/9be66192f9db40e5a43f71fc78e06b2f35e9ccdd/libsolidity/ast/Types.cpp#L2295) inside `StructType::isDynamicallyEncoded()` when a struct contains a function-type member whose return type carries `calldata` data location.
MRE:
```solidity
contract C { struct S { function() returns (S[2] calldata) a; } }
```
Reproduce: save as `mre.sol`, run `solc --bin mre.sol`.
Output:
```
Internal compiler error:
/solidity/libsolidity/ast/Types.cpp(2295): Throw in function virtual bool solidity::frontend::StructType::isDynamicallyEncoded() const
Dynamic exception type: boost::wrapexcept
std::exception::what: Solidity assertion failed
[solidity::util::tag_comment*] = Solidity assertion failed
```
Expected behavior: a type error explaining that `calldata` is not a valid data location for a function-type return value, or that such a type cannot be used as a struct member.
Git commit: 9be66192f
solc 0.8.35-develop.2026.4.18+commit.9be66192.Linux.g++
Contributor guide
Research direction
Reproduce the ICE with the `mre.sol` example using `solc --bin mre.sol`, then inspect `libsolidity/ast/Types.cpp:2295` in `StructType::isDynamicallyEncoded()`. Done means this input produces a type error about the invalid `calldata` function return or struct member instead of an internal compiler error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100