Skip to content

Compiler bug when using multiline string on attribute #23964

Description

@phoenixr-codes
V version: V 0.4.9 5978cbc, press to see full `v doctor` output
V full version V 0.4.9 21874f9.5978cbc
OS linux, "EndeavourOS Linux"
Processor 8 cpus, 64bit, little endian, 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
Memory 3.89GB/7.56GB
V executable /home/jonas/.local/v/v
V last modified time 2025-03-17 14:15:59
V home dir OK, value: /home/jonas/.local/v
VMODULES OK, value: /home/jonas/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/jonas/Projects/playground/v_multiline_string
Git version git version 2.48.1
V git status weekly.2025.11-48-g5978cbcf
.git/config present true
cc version cc (GCC) 14.2.1 20250207
gcc version gcc (GCC) 14.2.1 20250207
clang version clang version 19.1.7
tcc version tcc version 0.9.28rc 2024-07-31 HEAD@1cee0908 (x86_64 Linux)
tcc git status thirdparty-linux-amd64 0134e9b9
emcc version N/A
glibc version ldd (GNU libc) 2.41

What did you do?
./v -g -o vdbg cmd/v && ./vdbg src/main.v && src/main

module main

import os
import flag

@[footer: 'Hello
World']
pub struct Config {}

fn main() {
	config, _ := flag.to_struct[Config](os.args, skip: 1)!
	dump(config)
}

This only happens when using a multiline string on the footer attribute and parsing with .to_struct(...) (or .using(...). So omitting the body of main results in a successful compilation.

What did you see?

================== C compilation error (from tcc): ==============
cc: /tmp/v_1000/main.01JPJ7CH9DQ9HPAPS0XDM6JWRJ.tmp.c:8583: error: missing terminating " character
=================================================================
(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 expect a successful compilation.

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

Labels

BugThis tag is applied to issues which reports bugs.Status: ConfirmedThis bug has been confirmed to be valid by a contributor.Unit: cgenBugs/feature requests, that are related to the default C generating backend.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions