www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17825] New: Structs with floating point fields fail to


          Issue ID: 17825
           Summary: Structs with floating point fields fail to compile in
           Product: D
           Version: D2
          Hardware: x86
                OS: Linux
            Status: NEW
          Keywords: betterC
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: azi.hassan live.fr

The following code fails to compile in betterC :

import core.stdc.stdio;

struct Foo
    float x;

extern(C) int main(int argc, char** argv)
    return 0;

Attempting to compile it results in the following errors :

$ dmd -betterC structbug.d
structbug.o:(.data._D11TypeInfo_xf6__initZ+0x0) : référence indéfinie vers
_D14TypeInfo_Const6__vtblZ »
structbug.o:(.data._D11TypeInfo_xf6__initZ+0x8) : référence indéfinie vers
_D10TypeInfo_f6__initZ »
collect2: error: ld returned 1 exit status
Error: linker exited with status 1

(compiled with DMD32 D Compiler v2.076.0-dirty under Lubuntu 14.04)

The same problem occurs when using double instead of float.

The problem was initially posted here :
http://forum.dlang.org/post/rpzkeqilktdrplutquhy forum.dlang.org

Sep 13 2017