www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 850] New: we need (*type).property to refer to property if we use typedef

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

           Summary: we need (*type).property to refer to property if we use
                    typedef
           Product: D
           Version: 1.00
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: davidl 126.com


module test.test;
class test
{
        int myMember;
}
typedef test *ptest;
void main()
{
        ptest k;
        k.myMember = 1;
}
dmd complains:
test.d(10): Error: no property 'myMember' for type 'test*'
test.d(10): Error: constant (k).myMember is not an lvalue

typedef test *ptest; <--- the problem is here. I think it's 
something related to dmd's strong type mechanism. 
alias test *ptest; // this would work fine

i don't know if i can call this a bug , but at least the 
compile message should be nicer. Leave to u to decide either
this should be a bug or an enhancement.


-- 
Jan 14 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=850


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
           Keywords|                            |rejects-valid
            Summary|we need (*type).property to |we need (*type).property to
                   |refer to property if we use |refer to property if we use
                   |typedef                     |typedef




------- Comment #1 from smjg iname.com  2007-01-15 07:37 -------
Because of the 'is a' principle of typedefs, this should work.  I call this a
bug.


-- 
Jan 15 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=850


thomas-dloop kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Windows                     |All




------- Comment #2 from thomas-dloop kuehne.cn  2007-04-05 05:27 -------
Added to DStress as
http://dstress.kuehne.cn/run/t/typedef_23_A.d
http://dstress.kuehne.cn/run/t/typedef_23_B.d
http://dstress.kuehne.cn/run/t/typedef_23_C.d
http://dstress.kuehne.cn/run/t/typedef_23_D.d


-- 
Apr 05 2007