You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a variable other than int, we create a reference and tried to print the reference.
Reproduction Steps
fnmain() {
s:='Hello'p:=&s
println('${p}')
}
If above s is int or u8 there is no error and prints a number. If s is rune or f32 also there is a C error.
Expected Behavior
Get the number of the address (like with an integer).
Current Behavior
Running code...
Can't run code. The server returned an error:
/tmp/v_60000/../../../../../../box/code.v:4: warning: implicit declaration of function 'isnil'
/home/admin/v/thirdparty/tcc/lib/libgc.a: error: 'GC_noop1_ptr' defined twice
tcc: error: undefined symbol 'isnil'
builder error:
==================
C error found. It should never happen, when compiling pure V code.
This is a V compiler bug, please report it using `v bug file.v`,
or goto https://github.com/vlang/v/issues/new/choose .
You can also use #help on Discord: https://discord.gg/vlang .
Exited with error status 1
Please try again.
____ ____
\ \ / / | Welcome to the V REPL (for help with V itself, type exit , then run v help ).
\ \/ / | Note: the REPL is highly experimental. For best V experience, use a text editor,
\ / | save your code in a main.v file and execute: v run main.v
\ / | V 0.4.9 6f7cbd1 . Use list to see the accumulated program so far.
\__/ | Use Ctrl-C or exit to exit, or help to see other available commands.
>>> s := 'Hello'
>>> p := &s
>>> println('${p}')
&Hello
>>>
Commits linked here solved the C error problem by printing & followed by the value of the object referenced. I noticed printing the references with :x format we can get the numbers as with integers:
Describe the bug
We have a variable other than int, we create a reference and tried to print the reference.
Reproduction Steps
If above
s
isint
oru8
there is no error and prints a number. Ifs
isrune
orf32
also there is a C error.Expected Behavior
Get the number of the address (like with an integer).
Current Behavior
Possible Solution
Related with this issue #23460
Additional Information/Context
In REPL is harmless:
V version
V 0.4.9 a20fff9
Environment details (OS name and version, etc.)
https://play.vlang.io/p/04a4c8aab1
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: