Skip to content

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

@chisa22

Description

@chisa22

C2Rust fails to transpile a valid C program that initializes a double using a braced scalar initializer.
In C, scalar initialization with braces is valid, and the following program should be accepted.
Reproducer

int main(void) {
    double x = { 0.0 };
    return 0;
}

Observed Behavior
C2Rust fails during translation with:

error: Failed to translate main: Init list not implemented for Double

It also still emits an incomplete Rust file:

pub fn main() {
    unsafe { ::std::process::exit(main_0() as i32) }
}

where main_0 is missing.
Environment

  • c2rust version: v0.21.0
  • platform: Ubuntu 24.04
  • Rust: nightly-2022-08-08
  • Clang version: 17.0.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions