Weird dmd error?

Anonymous via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 7 02:57:49 PST 2016


On Monday, 7 November 2016 at 09:58:08 UTC, Anonymous wrote:
> On Monday, 7 November 2016 at 08:34:55 UTC, Andrea Fontana 
> wrote:
>>
>> --- test.d
>> void* test (ssize_t );
>> import core.sys.posix.unistd;
>> ---
>>
>> Try to run:
>> dmd test.d
>>
>> It says:
>> /usr/include/dmd/druntime/import/core/sys/posix/sys/types.d(100): Error: undefined identifier 'c_long'
>
> It looks normal but it's not documented. It's just that the 
> import is not yet known in the scope.

To be clearer, the problem is the same with:

void main()
{
     foo;
     void foo(){}
}

Exactly the same thing happens. There's already 3 semantic 
passes. To solve this kind of forward references another semantic 
pass would be required. But in this case you couldn't determine 
how many passes would be necessary so there would be a  
complexity problem in the compiler.


More information about the Digitalmars-d mailing list