Thread overview
[Issue 850] New: we need (*type).property to refer to property if we use typedef
Jan 15, 2007
d-bugmail
Jan 15, 2007
d-bugmail
Apr 05, 2007
d-bugmail
Dec 09, 2011
Ellery Newcomer
Feb 15, 2012
Lukasz Wrzosek
January 15, 2007
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.


-- 

January 15, 2007
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.


-- 

April 05, 2007
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


-- 

December 09, 2011
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


--- Comment #3 from Ellery Newcomer <ellery-newcomer@utulsa.edu> 2011-12-08 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: -------
February 15, 2012
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


--- Comment #4 from Lukasz Wrzosek <luk.wrzosek@gmail.com> 2012-02-15 08:31:12 PST ---
Checked dmd(In reply to comment #3)
> 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: -------