d: Return promoted types in d_type_promotes_to when linkage is not D
authorIain Buclaw <ibuclaw@gdcproject.org>
Sat, 12 Sep 2020 14:48:58 +0000 (16:48 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Sat, 12 Sep 2020 19:34:38 +0000 (21:34 +0200)
commit707e9159ed25d19c174e4da18b194e530878d450
treec28d409b32c482ff55965576c1198b0a1568d3d2
parente4011c13c1f8d51f00af61bcb8189bcbe45823b7
d: Return promoted types in d_type_promotes_to when linkage is not D

This enables warnings to be shown when a bad type is passed to va_arg
inside an extern(C) or extern(C++) function.

gcc/d/ChangeLog:

PR d/97002
* d-codegen.cc (d_build_call): Set input_location on CALL_EXPR.
* d-lang.cc: Include function.h.
(d_type_promotes_to): Do default conversions for C and C++ functions.
* intrinsics.cc (expand_intrinsic_vaarg): Use build1_loc to build
VA_ARG_EXPR.

gcc/testsuite/ChangeLog:

PR d/97002
* gdc.dg/pr97002.d: New test.
gcc/d/d-codegen.cc
gcc/d/d-lang.cc
gcc/d/intrinsics.cc
gcc/testsuite/gdc.dg/pr97002.d [new file with mode: 0644]