Confusing errors when printing a C struct #19512
Labels
Bug
This tag is applied to issues which reports bugs.
Build
V build error on any OS/CPU architecture.
Unit: cgen
Bugs/feature requests, that are related to the default C generating backend.
Describe the bug
v generates C code with _str functions that fail with "incomplete type" errors if a C struct is printed, and this isn't communicated well by v's error message.
Reproduction Steps
Try to compile this example program
Expected Behavior
An error from v about not being able to print the struct.
Current Behavior
Possible Solution
No response
Additional Information/Context
This error can reasonably happen when println() is used in placeholder code to ensure a variable is used:
This prints a warning as the variable
wl
is used. I added aprintln(wl)
to silence that for the moment and the strange error had me thinking I had some worse problem.V version
V 0.4.2 5c37c31
Environment details (OS name and version, etc.)
OS: linux
Processor: 4 cpus, 64bit, little endian, aarch64
CC version: cc (GCC) 12.1.0
thirdparty/tcc status: thirdparty-linux-aarch64 dd547903
Note
You can vote for this issue using the 👍 reaction. More votes increase the issue's priority for developers.
Take into account that only the 👍 reaction counts as a vote.
Only reactions to the issue itself will be counted as votes, not comments.
The text was updated successfully, but these errors were encountered: