[Issue 6318] New: module isn't fully processed under weird conditions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 14 10:52:36 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6318

           Summary: module isn't fully processed under weird conditions
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: mrmocool at gmx.de


--- Comment #0 from Trass3r <mrmocool at gmx.de> 2011-07-14 10:47:22 PDT ---
One of the weirdest bugs I've ever encountered.
Set up a directory named 'basic'. Inside there 3 files:

module basic.Messages;

//import basic.utils; // for flattenNamedEnum

pragma(msg, "foo");

enum Severity
{
    NOTE,
}
pragma(msg, flattenNamedEnum!Severity);

pragma(msg, "bar");
// definition of enum Msg is normally mixed in here

====

module basic.Bar;

import basic.Handle;
import basic.Messages;

class Bar
{
public:
    enum Level
    {
        Ignored,
    }
    void bla(Msg msg)
    {
    }
}

====

module basic.Handle;

import basic.Bar;

void foo(Bar.Level level)
{
}

I compiled it from inside the folder with 'dmd -c -I.. Bar.d Handle.d'

Bar.d(13): Error: undefined identifier Msg
foo

Note how basic.Messages is only evaluated to a certain degree.


The same happens with
dmd -c -I.. Bar.d Handle.d Messages.d
dmd -c -I.. Bar.d Messages.d Handle.d

Only with 'dmd -c -I.. Handle.d Bar.d' it yields
foo
../basic/Messages.d(14): Error: template instance template 'flattenNamedEnum'
is not defined
__error
bar
Bar.d(16): Error: undefined identifier Msg

And with 'dmd -c -I.. Messages.d Bar.d Handle.d':
foo
Messages.d(14): Error: template instance template 'flattenNamedEnum' is not
defined
__error
bar
Bar.d(16): Error: undefined identifier Msg


Also note that adding the definition of Msg by hand like
enum Msg { f }
or commenting out the flattenNamedEnum mixin also shows similar results.

Can anyone confirm this?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list