Issue 6805 - Can't use a type from opDispatch template
Summary: Can't use a type from opDispatch template
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: patch, rejects-valid
Depends on:
Blocks:
 
Reported: 2011-10-12 06:53 UTC by Denis Shelomovskii
Modified: 2011-11-20 11:38 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 Denis Shelomovskii 2011-10-12 06:53:44 UTC
---
struct T {
    template opDispatch(string name)
    {
        alias int Type;
    }
}

pragma(msg, T.opDispatch!("xxx"), " ", T.xxx); //(T).opDispatch!("xxx") (T).opDispatch!("xxx")
pragma(msg, T.opDispatch!("xxx").Type, " ", T.xxx.Type); //int int
pragma(msg, is(T.opDispatch!("xxx").Type), " ", is(Flag.xxx.Type)); //true false

template U(T) { }

void main() {
    T.opDispatch!("xxx").Type i1; //ok
    T.xxx.Type i2; //Error: T.xxx.Type is used as a type
    
    alias U!(T.opDispatch!("xxx").Type) U1; //ok
    alias U!(T.xxx.Type) U2; //Error: template instance U!(int) does not match template declaration U(T)
}
---