dstress alias_17.d

Brad Roberts braddr at puremagic.com
Sat Jan 27 00:22:31 PST 2007


The error message for this test case has changed from what it was when 
it was created.

 From bugs/2983, DMD 0.111 outputs:
     Assertion failure: '0' on line 909 in file 'func.c'
     abnormal program termination

With DMD 1.00
$ dmd alias_17.d
alias_17.d(17): variable dstress.nocompile.alias_17._test is aliased to 
a function
alias_17.d(21): function dstress.nocompile.alias_17.test () does not 
match parameter types (int)
alias_17.d(21): Error: expected 0 arguments, not 1

$ cat -n alias_17.d
      1  // $HeadURL: http://dstress.kuehne.cn/nocompile/alias_17.d $
      2  // $Date: 2005-12-03 23:19:07 +0100 (Sat, 03 Dec 2005) $
      3  // $Author: thomask $
      4
      5  // @author@     Ilya Zaitseff <sark7 at mail333.com>
      6  // @date@       2005-02-14
      7  // @uri@        news:opsl6xrbnaaaezs2 at robingood
      8  // @url@        nntp://news.digitalmars.com/digitalmars.D.bugs/2983
      9
     10  // __DSTRESS_ELINE__ 18
     11
     12  module dstress.nocompile.alias_17;
     13
     14  void test(){
     15  }
     16
     17  int _test;
     18  alias _test test;
     19
     20  void check(){
     21          test = 1;
     22  }

Now the fun question.. is this invalid code or not?  It's a form of 
shadowing as there's two 'test's in play.  The error messages do 
indicate that, though the line producing the error surprises me.  My 
instinct would have been that the alias line would have been messaged. 
I wonder how hard it'd be for all three lines to be referenced just to 
make it very clear what's going on.

The easy thing to do would be to change line 10 to point at 17 instead 
of 18 and move along, considering the original bug fixed.

Thoughts?

Later,
Brad


More information about the Digitalmars-d-bugs mailing list