crytic / crytic/slither

[Bug-Candidate]: The ternary operator does not support structs.

Open
#2,836 0 comments 0 reactions 0 assignees View on GitHub
bug-candidate
Dominant language
Python
Stars
6.4k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

### Describe the issue:

Run `slither a.sol` given:

```
slither.slithir.exceptions.SlithIRError: Ternary operator are not convertible to SlithIR if true then a.user else b.user
ERROR:root:Error:
ERROR:root:Ternary operator are not convertible to SlithIR if true then a.user else b.user
ERROR:root:Please report an issue to https://github.com/crytic/slither/issues`
```

### Code example to reproduce the issue:

```
contract A {
struct S {
uint32 user;
}
}

contract B {
A.S a;

A.S b;

A[] array = new A[]((true ? a.user : b.user));
}
```

### Version:

0.11.3

### Relevant log output:

```shell

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.