[Issue 23595] New: Error: undefined identifier with static if and module/import order

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 3 16:57:08 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23595

          Issue ID: 23595
           Summary: Error: undefined identifier with static if and
                    module/import order
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ibuclaw at gdcproject.org

This works

    dmd -o- png.d simpleaudio.d

This doesn't

    dmd -o- simpleaudio.d png.d

    core/types.d(8): Error: undefined identifier `__SIZEOF_PTHREAD_MUTEX_T`


---
module simpleaudio;
struct AudioOutputThread
{
    alias Sample = AudioPcmOutThreadImplementation.Sample;
}

import core.types;

class AudioPcmOutThreadImplementation
{
    void[pthread_mutex_t.sizeof] _slock;
    struct Sample { }
}
---
module png;
struct GC
{
    import core.types;
}
---
module core.types;
enum __WORDSIZE = 64;

static if (__WORDSIZE)
    enum __SIZEOF_PTHREAD_MUTEX_T = 1;

union pthread_mutex_t
{
    byte[__SIZEOF_PTHREAD_MUTEX_T] __size;
}

--


More information about the Digitalmars-d-bugs mailing list