www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - DMD 0.95 bug: template references to alias in argument's namespace

reply Burton Radons <burton-radons shaw.ca> writes:
This code doesn't compile properly.  The first line in classTemplate 
works, but the second reports the error "no property 'type' for type 
'classBase'".  It should create a field of the given alias type.

     class classBase
     {
         alias int type;
         const int constant = 1;
     }

     class classTemplate (parameter)
     {
         int value = parameter.constant;
         parameter.type field;
     }

     alias classTemplate! (classBase) instantiation;
Jul 17 2004
next sibling parent reply Andrew Edwards <ridimz_at yahoo.dot.com> writes:
Burton Radons wrote:

 This code doesn't compile properly.  The first line in classTemplate 
 works, but the second reports the error "no property 'type' for type 
 'classBase'".  It should create a field of the given alias type.
 
     class classBase
     {
         alias int type;
         const int constant = 1;
     }
 
     class classTemplate (parameter)
not sure but shouldn't it be: class classTemplate (alias parameter) instead? Compiles fine with this change!
     {
         int value = parameter.constant;
         parameter.type field;
     }
 
     alias classTemplate! (classBase) instantiation;
Jul 17 2004
parent Burton Radons <burton-radons shaw.ca> writes:
Andrew Edwards wrote:

 Burton Radons wrote:
 
 This code doesn't compile properly.  The first line in classTemplate 
 works, but the second reports the error "no property 'type' for type 
 'classBase'".  It should create a field of the given alias type.

     class classBase
     {
         alias int type;
         const int constant = 1;
     }

     class classTemplate (parameter)
not sure but shouldn't it be: class classTemplate (alias parameter) instead? Compiles fine with this change!
If I understand it correctly, using alias only loosens restrictions on the types of symbols you can pass for the argument. So that only shows that the bug doesn't exist for alias arguments, and that it remains for non-alias.
Jul 18 2004
prev sibling parent "Walter" <newshound digitalmars.com> writes:
It is a bug, and a fix for it will be in the next update. -Walter
Jul 20 2004