[Issue 7897] Problem with alias template parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Apr 20 16:13:59 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7897


Manu <turkeyman at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |


--- Comment #4 from Manu <turkeyman at gmail.com> 2012-04-20 16:14:55 PDT ---
Here, I've simplified it some more. This is functionally identical to the first
example, I just rephrased it to 'int' to remove any confusion about function
pointers and intent.


// member contained in a struct
struct Thing
{
    int x;
}

Thing thing; // this is effectively identical to declaring 'int x;' globally,
it's just wrapped in a thin struct

int x; // i'll also do it directly, to prove it works.

void main()
{
    // these 3 statements should be effectively identical
    thing.x = 10;               // this works, obviously
    AliasTheStruct!( thing )(); // this works
    AliasTheInt!( thing.x )();  // this is the problem

    AliasTheInt!( x )();        // of course, this works fine
}

void AliasTheStruct( alias a )()
{
    a.x = 10;
}

void AliasTheInt( alias a )()
{
    a = 10;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list