November 20
/ldc/import/core/stdc/stdint.d(96): Error: undefined identifier `cpp_longlong`
/ldc/import/core/stdc/stdint.d(97): Error: undefined identifier `cpp_ulonglong`
/ldc/import/core/stdc/stdint.d(118): Error: undefined identifier `cpp_ulong`

I am sure it defined because I add static assert to confirm this config.d:

version (Windows)
{
    enum __c_long  : int;
    enum __c_ulong : uint;

    alias int   c_long;
    alias uint  c_ulong;

    alias __c_long   cpp_long;
    alias __c_ulong  cpp_ulong;

    alias long  cpp_longlong;
    alias ulong cpp_ulonglong;
}
else version (Posix)
{
  static if ( (void*).sizeof > int.sizeof )
  {
    enum __c_longlong  : long;
    enum __c_ulonglong : ulong;

    alias long  c_long;
    alias ulong c_ulong;

    alias long   cpp_long;
    alias ulong  cpp_ulong;

    alias __c_longlong  cpp_longlong;
    alias __c_ulonglong cpp_ulonglong;
  }
  else
  {
    enum __c_long  : int;
    enum __c_ulong : uint;

    alias int   c_long;
    alias uint  c_ulong;

    alias __c_long   cpp_long;
    alias __c_ulong  cpp_ulong;

    alias long  cpp_longlong;
    alias ulong cpp_ulonglong;
  }
  static assert(false);
}

If I run a simple test file, it will work.

But in big project there is a lot import circular reference, and some args or file order. I get it.

LDC 1.40.0-beta4 for macOS.

I also test on linux ldc 1.40.0-beta4, the error changed:

/ldc/import/core/sys/posix/sys/types.d(109): Error: undefined identifier `c_long`
November 20

On Wednesday, 20 November 2024 at 07:02:25 UTC, Dakota wrote:

>

I am sure it defined because I add static assert to confirm this config.d:

and not sure how to work this around:

 #0 0x0000000103d4e8f7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/ldc/bin/ldc2+0x1038098f7)
 #1 0x0000000103d4c976 llvm::sys::RunSignalHandlers() (/ldc/bin/ldc2+0x103807976)
 #2 0x0000000103d4f0c0 SignalHandler(int) (/ldc/bin/ldc2+0x10380a0c0)
 #3 0x00007ff8111ef5ed (/usr/lib/system/libsystem_platform.dylib+0x7ff8004265ed)
 #4 0x0000000000000004
 #5 0x000000010418ac22 ToConstElemVisitor::visit(StructLiteralExp*) (/ldc/bin/ldc2+0x103c45c22)
 #6 0x0000000104148221 DtoConstExpInit(Loc const&, Type*, Expression*) (/ldc/bin/ldc2+0x103c03221)
 #7 0x00000001041c023e IrGlobal::define() (/ldc/bin/ldc2+0x103c7b23e)
 #8 0x0000000104129575 CodegenVisitor::visit(VarDeclaration*) (/ldc/bin/ldc2+0x103be4575)
 #9 0x000000010412903d CodegenVisitor::visit(AttribDeclaration*) (/ldc/bin/ldc2+0x103be403d)
#10 0x000000010412903d CodegenVisitor::visit(AttribDeclaration*) (/ldc/bin/ldc2+0x103be403d)
#11 0x000000010412903d CodegenVisitor::visit(AttribDeclaration*) (/ldc/bin/ldc2+0x103be403d)
#12 0x0000000104129e7d CodegenVisitor::visit(StructDeclaration*) (/ldc/bin/ldc2+0x103be4e7d)
#13 0x000000010412903d CodegenVisitor::visit(AttribDeclaration*) (/ldc/bin/ldc2+0x103be403d)
#14 0x0000000104150786 codegenModule(IRState*, Module*) (/ldc/bin/ldc2+0x103c0b786)
#15 0x00000001041d59ba ldc::CodeGenerator::emit(Module*) (/ldc/bin/ldc2+0x103c909ba)
#16 0x00000001041ef554 codegenModules(Array<Module*>&) (/ldc/bin/ldc2+0x103caa554)
#17 0x00000001040e59c1 mars_tryMain(Param&, Array<char const*>&) (/ldc/bin/ldc2+0x103ba09c1)
Error: Error executing /ldc/bin/ldc2: Segmentation fault: 11

linux:

 #0 0x000055a0c888d757 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/ldc/bin/ldc2+0x6dc5757)
 #1 0x000055a0c888b54c llvm::sys::RunSignalHandlers() (/ldc/bin/ldc2+0x6dc354c)
 #2 0x000055a0c888ddff SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f72233e7050 (/lib/x86_64-linux-gnu/libc.so.6+0x3c050)
 #4 0x000055a0c8b97a83 ToConstElemVisitor::visit(AddrExp*) ld-temp.o:0:0
 #5 0x000055a0c8b987f4 ToConstElemVisitor::visit(StructLiteralExp*) ld-temp.o:0:0
 #6 0x000055a0c8b40166 DtoConstExpInit(Loc const&, Type*, Expression*) (/ldc/bin/ldc2+0x7078166)
 #7 0x000055a0c8bcf23f IrGlobal::define() (/ldc/bin/ldc2+0x710723f)
 #8 0x000055a0c8b4fa13 CodegenVisitor::visit(VarDeclaration*) ld-temp.o:0:0
 #9 0x000055a0c8b4f41d CodegenVisitor::visit(AttribDeclaration*) ld-temp.o:0:0
#10 0x000055a0c8b4f41d CodegenVisitor::visit(AttribDeclaration*) ld-temp.o:0:0
#11 0x000055a0c8b4f41d CodegenVisitor::visit(AttribDeclaration*) ld-temp.o:0:0
#12 0x000055a0c8b502bd CodegenVisitor::visit(StructDeclaration*) ld-temp.o:0:0
#13 0x000055a0c8b4f41d CodegenVisitor::visit(AttribDeclaration*) ld-temp.o:0:0
#14 0x000055a0c8b53e12 codegenModule(IRState*, Module*) (/ldc/bin/ldc2+0x708be12)
#15 0x000055a0c8bf0415 ldc::CodeGenerator::emit(Module*) (/ldc/bin/ldc2+0x7128415)
#16 0x000055a0c56312a8 codegenModules(Array<Module*>&) (/ldc/bin/ldc2+0x3b692a8)
#17 0x000055a0c55da231 mars_tryMain(Param&, Array<char const*>&) (/ldc/bin/ldc2+0x3b12231)
#18 0x000055a0c5634510 cppmain() (/ldc/bin/ldc2+0x3b6c510)
#19 0x000055a0c8daa1bd _D2rt6dmain212_d_run_main2UAAamPUQgZiZ6runAllMFZv (/ldc/bin/ldc2+0x72e21bd)
#20 0x000055a0c8da9f98 _d_run_main2 (/ldc/bin/ldc2+0x72e1f98)
#21 0x000055a0c8da9dad _d_run_main (/ldc/bin/ldc2+0x72e1dad)
#22 0x000055a0c8becff8 main (/ldc/bin/ldc2+0x7124ff8)
#23 0x00007f72233d224a __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#24 0x00007f72233d2305 call_init ./csu/../csu/libc-start.c:128:20
#25 0x00007f72233d2305 __libc_start_main ./csu/../csu/libc-start.c:347:5
#26 0x000055a0c5638f6e _start (/ldc/bin/ldc2+0x3b70f6e)
Error: Error executing /ldc/bin/ldc2: Segmentation fault