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
}

Reply via email to