Parenthesized custom error in require statement throws bad_cast exception
Open
bug :bug:
low effort
low impact
must have
should compile without error
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 21
Description
Parenthesizing a custom error like below leads to a `std::bad_cast` exception being thrown.
```
pragma solidity >=0.0.0;
contract C {
error E();
function f() external pure { require(false, (E())); }
}
```
Contributor guide
Research direction
Start by reproducing the reported `std::bad_cast` with the Solidity snippet in the issue, then trace how the compiler handles `require` with a parenthesized custom error argument. Identify the relevant compiler tests for custom errors and add a regression case showing the example compiles or reports the expected behavior without throwing. No file or test path is named in the issue.
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
- Mostly clear
- Newbie friendliness
- 57/100