We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
module main struct Wrapper { a int } fn test[T](a &T) Wrapper { $if T is int { return Wrapper{a} } return Wrapper{} } fn main() { a := 123 println(test(a).a) }
Run the code above
123
Prints a random number
-654598052
No response
V 0.4.5 58a8fc6
V full version: V 0.4.5 b347f54.58a8fc6 OS: linux, Linux version 6.8.9-300.fc40.x86_64 (mockbuild@5f5c14101bdf4cb8942130379360ff7d) (gcc (GCC) 14.0.1 20240411 (Red Hat 14.0.1-0), GNU ld version 2.41-34.fc40) #1 SMP PREEMPT_DYNAMIC Thu May 2 18:59:06 UTC 2024 Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i5-4310U CPU @ 2.00GHz getwd: /home/user/Projects/learncpp vexe: /home/user/.local/lib/v/v vexe mtime: 2024-05-13 20:51:27 vroot: OK, value: /home/user/.local/lib/v VMODULES: OK, value: /home/user/.vmodules VTMP: OK, value: /tmp/v_1002 Git version: git version 2.45.0 Git vroot status: weekly.2024.14-312-g58a8fc6c .git/config present: true CC version: cc (GCC) 14.1.1 20240507 (Red Hat 14.1.1-1) thirdparty/tcc status: thirdparty-linux-amd64 12f392c3
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:
Adding a dereference prints the expected value:
struct Wrapper { a int } fn test[T](a &T) Wrapper { $if T is int { return Wrapper{*a} // <- here } return Wrapper{} } fn main() { a := 123 println(test(a).a) }
Sorry, something went wrong.
What do you think @medvednikov @spytheman ?
No branches or pull requests
Describe the bug
Reproduction Steps
Run the code above
Expected Behavior
Current Behavior
Prints a random number
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.5 58a8fc6
Environment details (OS name and version, etc.)
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: