String literal should be validated to be UTF-8 sequence also when used with arrays.
Open
bug :bug:
low impact
medium effort
should report error
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 29
Description
The code `string memory s = hex'c0a80101';` produces an error since `hex'c0a80101'` is not a valid UTF-8 sequence. The same value used in an array literal is accepted by compiler. For instance, following code compiles without any errors or warnings: `string[2] memory data = [hex'74000001', hex'c0a80101'];`. It should be fixed so that, array literals are validated to contain UTF-8 sequences during conversion to the array of strings.
Contributor guide
Assessment
This issue has not been assessed yet.