[Issue 1196] regression: "cannot alias an expression"
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Tue May  8 14:29:55 PDT 2007
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=1196
bugzilla at digitalmars.com changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID
------- Comment #1 from bugzilla at digitalmars.com  2007-05-08 16:29 -------
Both examples fail when I try it with the same error message. The error message
is correct - an alias cannot be made of an expression (in this case, a string
literal). A working example would be:
template removeSpace(char[] s, int x = 0)
{
    static if (s[0] == ' '){
       const char[] removeSpace = removeSpace!(s[1..$], x+1);
    }else{
       const char[] removeSpace = s;
    }
}
struct Tuple(A...)
{
    alias A Tuple;
}
static assert("Hello you !" == removeSpace!("       Hello you !"));
-- 
    
    
More information about the Digitalmars-d-bugs
mailing list