D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 8169 - Method loses its compile-time evaluability when used through alias this
Summary: Method loses its compile-time evaluability when used through alias this
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: pull, rejects-valid
Depends on:
Blocks:
 
Reported: 2012-05-30 10:17 UTC by Tommi
Modified: 2012-05-30 22:37 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Tommi 2012-05-30 10:17:34 UTC
struct ValueImpl
{
    static immutable(int) getValue()
    {
        return 42;
    }
}

struct ValueUser
{
    ValueImpl m_valueImpl;
    alias m_valueImpl this;
}

void main(string[] args)
{
    static assert(ValueUser.getValue() == 42); // #1
}

Line #1 doesn't compile. Error: variable m_valueImpl cannot be read 
at compile time