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





Because of the 'is a' principle of typedefs, this should work.  I call this a
bug.


-- 
Jan 15 2007
prev sibling next 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





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
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=850


Ellery Newcomer <ellery-newcomer utulsa.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ellery-newcomer utulsa.edu



18:13:43 PST ---
alias doesn't seem to be any better.

dmd 2.056 64 bit linux,

alias JNINativeInterface_* JNIEnv;

struct JNINativeInterface_ {
    int FindClass;
}
void main(){
    JNIEnv* env;
    auto x = env.FindClass;
}

compiled results in 

foo.d(8): Error: no property 'FindClass' for type 'JNINativeInterface_*'

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 08 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=850


Lukasz Wrzosek <luk.wrzosek gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |luk.wrzosek gmail.com



PST ---

 alias doesn't seem to be any better.
 
 dmd 2.056 64 bit linux,
 
 alias JNINativeInterface_* JNIEnv;
 
 struct JNINativeInterface_ {
     int FindClass;
 }
 void main(){
     JNIEnv* env;
     auto x = env.FindClass;
 }
 
 compiled results in 
 
 foo.d(8): Error: no property 'FindClass' for type 'JNINativeInterface_*'
This case is wrong. variable env is of type JNINativeInterface_** so compiler rejects invalid code correctly. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 15 2012