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

generics, cgen: invalid cgen when mixing type aliases #23382

Closed
Le0Developer opened this issue Jan 5, 2025 · 0 comments · Fixed by #23393
Closed

generics, cgen: invalid cgen when mixing type aliases #23382

Le0Developer opened this issue Jan 5, 2025 · 0 comments · Fixed by #23393
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.

Comments

@Le0Developer
Copy link
Member

Le0Developer commented Jan 5, 2025

V doctor:

|V full version      |V 0.4.9 5b44b67.af1ef92
|:-------------------|:-------------------
|OS                  |macos, macOS, 15.2, 24C101
|Processor           |10 cpus, 64bit, little endian, Apple M4
|Memory              |0.4GB/16GB
|                    |
|V executable        |/Users/leodev/p/v/v/v
|V last modified time|2025-01-05 15:18:43
|                    |
|V home dir          |OK, value: /Users/leodev/p/v/v
|VMODULES            |OK, value: /Users/leodev/.vmodules
|VTMP                |OK, value: /tmp/v_501
|Current working dir |OK, value: /Users/leodev/p/v/fast2
|                    |
|Git version         |git version 2.47.0
|V git status        |weekly.2024.53-31-gaf1ef929 (1 commit(s) behind V master)
|.git/config present |true
|                    |
|cc version          |Apple clang version 16.0.0 (clang-1600.0.26.6)
|gcc version         |Apple clang version 16.0.0 (clang-1600.0.26.6)
|clang version       |Apple clang version 16.0.0 (clang-1600.0.26.6)
|tcc version         |tcc version 0.9.28rc 2024-02-05 HEAD@105d70f7 (AArch64 Darwin)
|tcc git status      |thirdparty-macos-arm64 713692d4
|emcc version        |N/A
|glibc version       |N/A

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

type I64 = i64

fn test[T](a ?T) ? {
	return none
}

fn main() {
	a := ?i64(123)
	b := test[I64](a)
	println(b)
}

What did you see?

================== C compilation error (from cc): ==============
cc: /tmp/v_501/repro.01JGVHF8TVE1GJF24R0361RXXP.tmp.c:5871:29: error: initializing 'main__I64' (aka 'long long') with an expression of incompatible type '_option_i64' (aka 'struct _option_i64')
cc:  5871 |         _option_ok(&(main__I64[]) {a }, (_option*)(&_t2), sizeof(main__I64));
cc:       |                                    ^
cc: 1 error generated.
================================================================
(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?

Successful compilaton

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.

Huly®: V_0.6-21813

@Le0Developer Le0Developer added the Bug This tag is applied to issues which reports bugs. label Jan 5, 2025
@felipensp felipensp self-assigned this Jan 6, 2025
@felipensp felipensp added 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. Option Type Bugs/feature requests, that are related to `?Type`. labels Jan 6, 2025
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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants