www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21055] New: core.stdc.stdarg is not nogc

https://issues.dlang.org/show_bug.cgi?id=21055

          Issue ID: 21055
           Summary: core.stdc.stdarg is not  nogc
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: betterC
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: dkorpel live.nl

```
import core.stdc.stdarg;
import core.stdc.stdio;

extern(C) void foo(const(char)* format, ...)  nogc {
    va_list vl;
    va_start(vl, format);
    vprintf(format, vl);
    va_end(vl);   
}

void main() {
    foo("ten = %d", 10);
}
```

onlineapp.d(6): Error:  nogc function onlineapp.foo cannot call non- nogc
function core.stdc.stdarg.va_start!(const(char)*).va_start
onlineapp.d(8): Error:  nogc function onlineapp.foo cannot call non- nogc
function core.stdc.stdarg.va_end

This makes no sense, the C code does not need a GC so neither should D. 
On top of core/stdc/stdarg.d it says:

// nogc:    // Not yet, need to make TypeInfo's member functions  nogc first

That was added when stdarg looked like this:
https://github.com/dlang/druntime/blob/8c07338efe375f8ba4b687c8e9085d4ba686963a/src/core/stdc/stdarg.d

Currently I see no trace of TypeInfo anymore.

--
Jul 18 2020