www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23595] New: Error: undefined identifier with static if and

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 puremagic.com
          Reporter: ibuclaw 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;
}

--
Jan 03 2023