www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 24521] New: Template value parameters are not visible outside

https://issues.dlang.org/show_bug.cgi?id=24521

          Issue ID: 24521
           Summary: Template value parameters are not visible outside
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com



```d
struct S(int a) { }

void main()
{
    alias S1 = S!1;
    static assert(S1.a);
}          
```



 t.d(6,19): Error: no property `a` for type `t.S!1`  
 t.d(1,1):        struct `S` defined here  
 t.d(6,5):        while evaluating: `static assert((S!1).a)`
I suspect that while I think this should work, the problem that's observed could actually be related to "how template arguments are scoped" (so maybe an implementation detail ?) But this does not work either: ```d template S(int a) { struct S { } } void main() { alias S1 = S!1; static assert(S1.a); } ``` --
Apr 25