[Bug d/97002] New: d: Promote types in d_type_promotes_to when linkage is not D
ibuclaw at gdcproject dot org
gcc-bugzilla@gcc.gnu.org
Wed Sep 9 16:52:35 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97002
Bug ID: 97002
Summary: d: Promote types in d_type_promotes_to when linkage is
not D
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: d
Assignee: ibuclaw at gdcproject dot org
Reporter: ibuclaw at gdcproject dot org
Target Milestone: ---
There is no promoting of variadic arguments when the linkage is D. However
extern(C) and extern(C++) functions do undergo type promotions.
This needs to be handled by d_type_promotes_to so that relevant warnings can be
issues on misuse of va_arg.
e.g:
import core.stdc.stdarg;
extern(C) int foo(short a, ...)
{
va_list ap;
va_start(ap, a);
auto f = va_arg!float(ap);
return cast(int)f;
}
int bar(short a, float f)
{
return foo(a, f); // passed as (double) f
}
More information about the Gcc-bugs
mailing list