1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: fix illegal character encoding with rune consts above 127 (#11550)

This commit is contained in:
El Koulali András 2021-09-20 09:45:42 +02:00 committed by GitHub
parent 1de4f1af2e
commit 9c4507d115
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -5210,7 +5210,7 @@ fn (mut g Gen) const_decl_precomputed(mod string, name string, ct_value ast.Comp
}
rune {
rune_code := u32(ct_value)
if rune_code <= 255 {
if rune_code <= 127 {
if rune_code in [`"`, `\\`, `'`] {
return false
}

View File

@ -0,0 +1,5 @@
const accented = `á`
fn test_high_ascii_const() {
assert u32(accented) == 225
}