atilaneves / dpp

Directly include C headers in D source code
Boost Software License 1.0
227 stars 31 forks source link

Wrong codegen for array of anonymous structs #351

Open denizzzka opened 1 week ago

denizzzka commented 1 week ago

On current ~master

C code:

static struct {
  const char *name;
} http_strerror_tab[] = {
  { "CB_message_begin" },
  { "CB_url" },
  { "CB_header_field" }
};

Will be translated into D code:

extern(C)
{

    extern __gshared _Anonymous_0[3] http_strerror_tab;
}

Compiler says on this module:

$ ldc2 -c test2.d
test2.d(56): Error: undefined identifier `_Anonymous_0`