Skip to content

compiler error when adding @[raw] to a non-string field in a struct #25286

@Nasko-5

Description

@Nasko-5
V version: V 0.4.11 38519ec, press to see full `v doctor` output
V full version V 0.4.11 38519ec
OS windows, Microsoft Windows 10 Pro 19045 64-bit
Processor 4 cpus, 64bit, little endian, Intel(R) Core(TM) i5-4460 CPU @ 3.20GHz
Memory 1.5GB/15.95GB
V executable D:\programs\v\v.exe
V last modified time 2025-08-26 06:29:11
V home dir OK, value: D:\programs\v
VMODULES OK, value: C:\Users\sect0.vmodules
VTMP OK, value: C:\Users\sect0\AppData\Local\Temp\v_0
Current working dir contains spaces, value: D:\My stuff\.programming\vlang\scraper
Git version git version 2.43.0.windows.1
V git status N/A
.git/config present false
cc version cc (Rev2, Built by MSYS2 project) 14.2.0
gcc version gcc (Rev2, Built by MSYS2 project) 14.2.0
clang version N/A
msvc version Microsoft (R) C/C++ Optimizing Compiler Version 19.39.33523 for x86
tcc version tcc version 0.9.27 (x86_64 Windows)
tcc git status N/A
emcc version N/A
glibc version N/A

What did you do?
./v -g -o vdbg cmd/v && ./vdbg .\olx\resultstructs.v && D:\My stuff\.programming\vlang\scraper\olx\resultstructs.exe
See attached file .\olx\resultstructs.v

What did you see?

olx/resultstructs.v:3:9: warning: module 'json2 (x.json2)' is imported but never used
    1 | module olx
    2 | 
    3 | import  x.json2
      |         ~~~~~~~
    4 | import time
    5 |
olx/resultstructs.v:1:1: error: project must include a `main` module or be a shared library (compile with `v -shared`)
    1 | module olx
      | ^
    2 | 
    3 | import  x.json2
================== C compilation error (from tcc): ==============
cc: D:/programs/v/thirdparty/vschannel/vschannel.c:300: warning: assignment from incompatible pointer type
cc: C:/Users/sect0/AppData/Local/Temp/v_0/scraper.01K4X0VTA6DDJVA07MAFX9RT3A.tmp.c:10409: error: cannot convert 'struct string' to 'struct olx__ParamValue'
...
cc: C:/Users/sect0/AppData/Local/Temp/v_0/scraper.01K4X0VTA6DDJVA07MAFX9RT3A.tmp.c:10409: error: cannot convert 'struct string' to 'struct olx__ParamValue'
(note: the original output was 13 lines long; it was truncated to its first 2 lines + the last line)
=================================================================
(You can pass `-cg`, or `-show-c-output` as well, to print all the C error messages).
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 .

What did you expect to see?

i kind of forgot to define ListingParams.value to use string instead of ParamValue... i was trying to figure out how to get json.decode to select PriceParam/CheckboxesParam/SelectParam depending on ListingParams.param_type

resultstructs.v.txt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Modules: x.json2Bugs related to *only* x.json2 (the pure V implementation)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions