www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2869] New: alias type not equel to origin type when typeof call on it

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2869

           Summary: alias type not equel to origin type when typeof call on
                    it
           Product: D
           Version: 2.028
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: galaxylang gmail.com


alias type not equel to origin type when typeof call on it 
only occur on the basic type
such as:
alias int inttype;
if(is(typeof(int))    //complier error
if(is(typeof(inttype))//OK


-- 
Apr 21 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2869


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID
            Summary|alias type not equel to     |alias type not equal to
                   |origin type when typeof call|origin type when typeof
                   |on it                       |called on it





The compiler is behaving correctly.

http://www.digitalmars.com/d/2.0/declaration.html#Typeof

Typeof:
        typeof ( Expression )
        typeof ( return )

"int" is not parseable as an expression, therefore "typeof(int)" correctly
fails to compile.

"inttype" is, OTOH, parseable as an expression, just not semantically valid as
one.  Therefore the IsExpression correctly evaluates to false.


-- 
Apr 27 2009