www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Bug: compiler crash when using module name twice

reply Matthias <m.atthi.as example.net> writes:
I'm very new to D and misused the module identifier, I thought it would 
be the namespace/package name.

The dmd compiler v2.046 produces correct output ("Error: module test 
from file xxx.d conflicts with another module test from file yyy.d"), if 
multiple placement of same module identifier are in the root of the 
project, however it crashes, when the files are in a subfolder and does 
not display a proper error message.

The output is:
Assertion failure: 'mprev' on line 641 in file 'module.c'

Test case:
--main.d--
import std.stdio;

import folder.File1;
import folder.File2;

int main(char[][] args)
{
     writefln(file2);
     return 0;
}

--folder\File1.d--
module folder;

const char[] file1 = "File1";

--folder\File2.d--
module folder;

const char[] file2 = "File2";

Used Code::Blocks.
May 27 2010
parent reply Don <nospam nospam.com> writes:
Matthias wrote:
 I'm very new to D and misused the module identifier, I thought it would 
 be the namespace/package name.
 
 The dmd compiler v2.046 produces correct output ("Error: module test 
 from file xxx.d conflicts with another module test from file yyy.d"), if 
 multiple placement of same module identifier are in the root of the 
 project, however it crashes, when the files are in a subfolder and does 
 not display a proper error message.

Ouch! I hate it when newbies hit compiler crashes. I've created a bug report: http://d.puremagic.com/issues/show_bug.cgi?id=4242 Hope to create a patch for it in the next few days.
May 27 2010
next sibling parent bearophile <bearophileHUGS lycos.com> writes:
Don:
 Ouch! I hate it when newbies hit compiler crashes.

This happens often. People that have more experience in D use it in the way it is meant to be used, so they follow the normal usage patterns, that are often tested enough (or have already known bugs). But newbies sometimes use D features in ways they where not meant to be used, so they go out of the well walked down footpath (I don't know how this is written in English), so they can often find bugs. Bye, bearophile
May 27 2010
prev sibling parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Thu, 27 May 2010 18:32:34 -0400, bearophile <bearophileHUGS lycos.com>  
wrote:
 out of the well walked down footpath (I don't know how this is written  
 in English)

off the well beaten path :) -Steve
May 27 2010