ldc-developers/ldc

Error: no init symbol for zero-initialized struct

Zoadian opened this issue · 1 comments

import std.stdio;
import core.stdc.config;

void main() {
__c_complex_float[] xxx = new __c_complex_float[10];
writeln(xxx);
}

results in "Error: no init symbol for zero-initialized struct".
it works with dmd.

Thx for the report. This boils down to:

import core.stdc.config;

void foo() {
    __c_complex_float x;
    x = typeof(x).init; // ICE - frontend incorrectly lowers it to the non-existent init symbol
}

Without that magic struct enum (enum __c_complex_float : _Complex!float;), all works fine, because .init is correctly lowered to a literal:

import core.stdc.config;

void foo() {
    _Complex!float x;
    x = typeof(x).init; // fine, assignment to a zero-initialized literal
}