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

pull/11553/head^2
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 {
rune_code := u32(ct_value) rune_code := u32(ct_value)
if rune_code <= 255 { if rune_code <= 127 {
if rune_code in [`"`, `\\`, `'`] { if rune_code in [`"`, `\\`, `'`] {
return false return false
} }

View File

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