-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Description
You have always been able to define variadic functions in C with no named parameters, but until C23 it was not useful because you could never access those arguments
Since C23 the va_start
macro in C has been changed to no longer require a parameter name, so now being able to call variadic functions with no named parameters is actually useful
extern "C" {
fn foo(...);
}
I would expect this to compile, if there was a function foo
defined in C like so
void foo(...) { // the ... is optional pre-c23, but since C23 its required to make the function variadic
// whatever implementation
}
But instead this does not compile
error: C-variadic function must be declared with at least one named argument
--> src\lib.rs:2:12
|
2 | fn foo(...);
| ^^^
Meta
rustc --version --verbose
:
binary: rustc
commit-hash: 07dca489ac2d933c78d3c5158e3f43beefeb02ce
commit-date: 2024-02-04
host: x86_64-pc-windows-msvc
release: 1.76.0
LLVM version: 17.0.6
m1lkweed, clubby789 and stepancheg
Metadata
Metadata
Assignees
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team