Skip to content

Error Variadic Parameters - [E0045] #2382

@MahadMuhammad

Description

@MahadMuhammad

Variadic Parameters Used on Non-C ABI Function

  • Fixing this error will improve gccrs to emit error codes similiar to rustc.
  • You can view the same on compiler-explorer

I tried this code from E0045:

// https://doc.rust-lang.org/error_codes/E0045.html
#![allow(unused)]
fn main() {
extern "Rust" {
    fn foo(x: u8, ...); // error!
}
}

I expected to see this happen:

  • Give error like rustc:
error[E0045]: C-variadic function must have C or cdecl calling convention
 --> <source>:4:5
  |
4 |     fn foo(x: u8, ...); // error!
  |     ^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention

error: aborting due to previous error

For more information about this error, try `rustc --explain E0045`.
Compiler returned: 1

Instead, this happened:

  • Compiled Successfully.
Compiler returned: 0

Meta

  • What version of Rust GCC were you using, git sha 5406b63.
  • Godbolt version : gccrs (Compiler-Explorer-Build-gcc-2f91d511200bf85558c9013b09a458c06edd1e02-binutils-2.40) 13.0.1 20230417 (experimental)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions