[Issue 21055] New: core.stdc.stdarg is not @nogc

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 18 13:25:46 UTC 2020


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 at puremagic.com
          Reporter: dkorpel at 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- at nogc
function core.stdc.stdarg.va_start!(const(char)*).va_start
onlineapp.d(8): Error: @nogc function onlineapp.foo cannot call non- at 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.

--


More information about the Digitalmars-d-bugs mailing list