Skip to content
New issue

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

Fixed array of Option of Struct as a Struct field yields a C error #17257

Closed
TheBrainScrambler opened this issue Feb 8, 2023 · 1 comment · Fixed by #21082
Closed

Fixed array of Option of Struct as a Struct field yields a C error #17257

TheBrainScrambler opened this issue Feb 8, 2023 · 1 comment · Fixed by #21082
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Option Type Bugs/feature requests, that are related to `?Type`. Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general.

Comments

@TheBrainScrambler
Copy link

Describe the bug

The code presented below gives the following C error:

/tmp/v_1000/bugged2.16976533346751976066.tmp.c:1091: error: declaration of an array of incomplete type elements

Expected Behavior

The code should either compile or present a V error.

Current Behavior

C error

Reproduction Steps

struct Test {}

struct Test2 {
        a       [10]?Test
}

Possible Solution

No response

Additional Information/Context

V has been installed on Arch Linux through the AUR, and not using cloning and v up. But in any case I'm using the latest V version as of today.

V version

V 0.3.3 d1f57ea

Environment details (OS name and version, etc.)

OS: linux, Linux version 5.15.90-1-lts (linux-lts@artixlinux) (gcc (GCC) 12.2.1 20230111, GNU ld (GNU Binutils) 2.40) #1 SMP Fri, 27 Jan 2023 12:35:43 +0000
Processor: 4 cpus, 64bit, little endian, Intel(R) Pentium(R) CPU 3825U @ 1.90GHz
CC version: cc (GCC) 12.2.1 20230111

getwd: /home/user/src/v
vmodules: /home/user/.vmodules
vroot: /usr/lib/vlang
vexe: /usr/lib/vlang/v
vexe mtime: 2023-02-06 11:16:26
is vroot writable: false
is vmodules writable: true
V full version: V 0.3.3 d1f57ea

Git version: git version 2.39.1
Git vroot status: Error: fatal: not a git repository (or any of the parent directories): .git
.git/config present: false
thirdparty/tcc status: Error: fatal: detected dubious ownership in repository at '/usr/lib/vlang/thirdparty/tcc'
To add an exception for this directory, call:

	git config --global --add safe.directory /usr/lib/vlang/thirdparty/tcc
 Error: fatal: detected dubious ownership in repository at '/usr/lib/vlang/thirdparty/tcc'
To add an exception for this directory, call:

	git config --global --add safe.directory /usr/lib/vlang/thirdparty/tcc
@TheBrainScrambler TheBrainScrambler added the Bug This tag is applied to issues which reports bugs. label Feb 8, 2023
@felipensp felipensp added the Unit: cgen Bugs/feature requests, that are related to the default C generating backend. label Feb 12, 2023
@felipensp
Copy link
Member

It is related to Option declaration ordering on C file.

@felipensp felipensp added the Status: Confirmed This bug has been confirmed to be valid by a contributor. label Feb 12, 2023
@felipensp felipensp self-assigned this Mar 23, 2024
@spytheman spytheman added Option Type Bugs/feature requests, that are related to `?Type`. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general. labels Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Option Type Bugs/feature requests, that are related to `?Type`. Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants