Skip to content

transpile: Handle InitList correctly for all scalar types#1697

Open
Rua wants to merge 3 commits intoimmunant:kkysen/transpile-snapshots-expect_unresolved_importfrom
Rua:init-list-scalar
Open

transpile: Handle InitList correctly for all scalar types#1697
Rua wants to merge 3 commits intoimmunant:kkysen/transpile-snapshots-expect_unresolved_importfrom
Rua:init-list-scalar

Conversation

@Rua
Copy link
Copy Markdown
Contributor

@Rua Rua commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

@kkysen kkysen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, too, but could we also add a snapshot test here?

@Rua
Copy link
Copy Markdown
Contributor Author

Rua commented Mar 26, 2026

I want to include f128 in the init list tests, but that will not work until #1688 has merged. So I'll wait.

Copy link
Copy Markdown
Contributor

@kkysen kkysen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to include f128 in the init list tests, but that will not work until #1688 has merged. So I'll wait.

#1688 has been merged now. And can you do the same before and after snapshot test thing?

@Rua
Copy link
Copy Markdown
Contributor Author

Rua commented Mar 31, 2026

I don't think that will work here. Init lists for many of these types were simply not implemented before this PR, so it would just not transpile.

@Rua Rua force-pushed the init-list-scalar branch from dd8bbf0 to 53cb567 Compare March 31, 2026 20:51
@kkysen
Copy link
Copy Markdown
Contributor

kkysen commented Mar 31, 2026

I don't think that will work here. Init lists for many of these types were simply not implemented before this PR, so it would just not transpile.

Ah, okay, then never mind then. Simple snapshot test after will be good.

@kkysen kkysen force-pushed the init-list-scalar branch from 53cb567 to 7528c4a Compare April 3, 2026 02:55
@Rua Rua force-pushed the init-list-scalar branch 3 times, most recently from 880db6a to d105e9e Compare April 3, 2026 09:34
@Rua
Copy link
Copy Markdown
Contributor Author

Rua commented Apr 3, 2026

It looks like this is now running into the same problem as #1716, so I'll wait for #1719 to merge. Also, __float128 apparently just isn't available on MacOS? How come f128.c seems to be passing all these tests?

Edit: Ah, that's why... see #1727.

@Rua Rua force-pushed the init-list-scalar branch from d105e9e to 22e19f1 Compare April 3, 2026 09:59
@kkysen kkysen changed the base branch from master to kkysen/transpile-snapshots-expect_unresolved_import April 3, 2026 16:20
@Rua Rua force-pushed the init-list-scalar branch 2 times, most recently from b2588a7 to fb74faa Compare April 3, 2026 17:18
@Rua Rua force-pushed the init-list-scalar branch 2 times, most recently from ef36fef to 06b9059 Compare April 3, 2026 17:40
Copy link
Copy Markdown
Contributor

@kkysen kkysen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that empty initializer list initialization of scalars was only added in C23, which Clang 15 doesn't support. Let me think of a solution.

@kkysen kkysen force-pushed the init-list-scalar branch from 06b9059 to a7d61df Compare April 4, 2026 13:33
…lists

Empty initializer lists for scalars is only supported in C23/clang 17,
so we condition the tests on that.
@Rua Rua force-pushed the init-list-scalar branch from a7d61df to 53c9604 Compare April 4, 2026 14:50
@Rua
Copy link
Copy Markdown
Contributor Author

Rua commented Apr 4, 2026

I think you had the right idea? I changed it a bit and now it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

C2Rust fails to translate valid scalar initializer list for double (Init list not implemented for Double)

3 participants