https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108763
Bug ID: 108763 Summary: va_arg usage in D doesn't compile Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: d Assignee: ibuclaw at gdcproject dot org Reporter: schveiguy at gmail dot com Target Milestone: --- Compiling a valid D module that uses varargs does not compile. The following is the source of `test.d`: ```d import core.vararg; void foo(...) { ubyte[128] buf; foreach(ti; _arguments) { va_arg(_argptr, ti, buf.ptr); } } ``` This is confirmed a valid module using both other D compilers, dmd and ldc. The output information of -v is: COLLECT_GCC=/opt/compiler-explorer/gcc-12.2.0/bin/gdc Target: x86_64-linux-gnu Configured with: ../gcc-12.2.0/configure --prefix=/opt/compiler-explorer/gcc-build/staging --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-bootstrap --enable-multiarch --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --enable-clocale=gnu --enable-languages=c,c++,fortran,ada,objc,obj-c++,go,d --enable-ld=yes --enable-gold=yes --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-linker-build-id --enable-lto --enable-plugins --enable-threads=posix --with-pkgversion=Compiler-Explorer-Build-gcc--binutils-2.38 --enable-libstdcxx-backtrace=yes Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.2.0 (Compiler-Explorer-Build-gcc--binutils-2.38) COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-g' '-o' '/app/output.s' '-masm=intel' '-S' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' '/app/' /opt/compiler-explorer/gcc-12.2.0/bin/../libexec/gcc/x86_64-linux-gnu/12.2.0/d21 <source> -quiet -dumpdir /app/ -dumpbase output.d -dumpbase-ext .d -masm=intel -mtune=generic -march=x86-64 -g -version -fdiagnostics-color=always -o /app/output.s -imultiarch x86_64-linux-gnu -iprefix /opt/compiler-explorer/gcc-12.2.0/bin/../lib/gcc/x86_64-linux-gnu/12.2.0/ -v GNU D (Compiler-Explorer-Build-gcc--binutils-2.38) version 12.2.0 (x86_64-linux-gnu) compiled by GNU C version 9.4.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU D (Compiler-Explorer-Build-gcc--binutils-2.38) version 12.2.0 (x86_64-linux-gnu) compiled by GNU C version 9.4.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 binary /opt/compiler-explorer/gcc-12.2.0/bin/../libexec/gcc/x86_64-linux-gnu/12.2.0/d21 version v2.100.1 predefs GNU D_Version2 LittleEndian GNU_DWARF2_Exceptions GNU_StackGrowsDown GNU_InlineAsm D_LP64 assert D_PreConditions D_PostConditions D_Invariants D_ModuleInfo D_Exceptions D_TypeInfo all X86_64 D_HardFloat Posix linux CRuntime_Glibc CppRuntime_Gcc As far as the command line, it would be: gdc -o test test.d The compiler output is: <source>:7:11: error: none of the overloads of template 'core.stdc.stdarg.va_arg' are callable using argument types '!()(__va_list_tag[1], TypeInfo, ubyte*)' 7 | va_arg(_argptr, ti, buf.ptr); | ^ /opt/compiler-explorer/gcc-12.2.0/lib/gcc/x86_64-linux-gnu/12.2.0/include/d/core/stdc/stdarg.d:172:7: note: Candidates are: 'va_arg(T)(ref va_list ap)' 172 | T va_arg(T)(ref va_list ap); // intrinsic | ^ /opt/compiler-explorer/gcc-12.2.0/lib/gcc/x86_64-linux-gnu/12.2.0/include/d/core/stdc/stdarg.d:271:10: note: 'va_arg(T)(ref va_list ap, ref T parmn)' 271 | void va_arg(T)(ref va_list ap, ref T parmn); // intrinsic | ^ The expected function should be implemented as identified in the D library here: https://dlang.org/phobos/core_vararg.html#.va_arg