Zig Version
0.10.0-dev.2836+2360f8c49
Steps to Reproduce
Exporting anything identified by @"" exports nothing. on wasm32, x86_64, aarch64, probably all platforms.
export const @"": u16 = 12345;
Expected Behavior
@"" is rejected as an identifier for exports. It's simply not representable. What is the compiler supposed to call it?
Additionally, any opinions on disallowing @"" as an identifier in general? Are there any use cases? It is inexpressive. What is @"" even supposed to mean? Disallowing it altogether might be more consistent. (nvm, I don't think this is good actually, could be missing some edge cases etc.)
See also: #8262
Actual Behavior
stage1
Exporting anything identified by @"" exports nothing. on wasm32, x86_64, aarch64, probably all platforms.
export const @"": u16 = 12345;
$ zig build-lib -dynamic -target wasm32-freestanding -OReleaseSmall --strip x.zig; wasm2wat x.wasm
(module
(memory (;0;) 1)
(global (;0;) (mut i32) (i32.const 65536))
(export "memory" (memory 0)))
12345 is nowhere to be found. Change @"" to @"x" and it's included.
$ zig build-lib -dynamic -target x86_64-freestanding -OReleaseSmall --strip x.zig -femit-asm; cat x.s
.text
.intel_syntax noprefix
.file "x"
.section ".note.GNU-stack","",@progbits
12345 is nowhere to be found. Change @"" to @"x" and it's included.
stage2
$ zig build-lib -dynamic -target wasm32-freestanding -OReleaseSmall --strip -fno-stage1 x.zig; wasm2wat x.wasm
(module
(memory (;0;) 2)
(global (;0;) (mut i32) (i32.const 65536))
(global (;1;) i32 (i32.const 65536))
(export "memory" (memory 0))
(export "test." (global 1))
(data (;0;) (i32.const 65536) "90"))
In stage2 it is somehow exported as "test.", which is very weird.
Additionally if you add -femit-asm to this one, it doesn't work. It works without -fno-stage1.
All this is unexpected.
Zig Version
0.10.0-dev.2836+2360f8c49
Steps to Reproduce
Exporting anything identified by
@""exports nothing. on wasm32, x86_64, aarch64, probably all platforms.Expected Behavior
@""is rejected as an identifier forexports. It's simply not representable. What is the compiler supposed to call it?Additionally, any opinions on disallowing
@""as an identifier in general? Are there any use cases? It is inexpressive. What is@""even supposed to mean? Disallowing it altogether might be more consistent. (nvm, I don't think this is good actually, could be missing some edge cases etc.)See also: #8262
Actual Behavior
stage1
Exporting anything identified by
@""exports nothing. on wasm32, x86_64, aarch64, probably all platforms.12345 is nowhere to be found. Change
@""to@"x"and it's included.12345 is nowhere to be found. Change
@""to@"x"and it's included.stage2
In stage2 it is somehow exported as
"test.", which is very weird.Additionally if you add
-femit-asmto this one, it doesn't work. It works without-fno-stage1.All this is unexpected.