Bug 24521 – Arguments supplied to template value parameters are not visible from the outside
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2024-04-25T11:12:08Z
Last change time
2024-08-22T16:35:37Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
basile-z
Comments
Comment #0 by b2.temp — 2024-04-25T11:12:08Z
## test case
```d
struct S(int a) { }
void main()
{
alias S1 = S!1;
static assert(S1.a);
}
```
## output
> 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)`
## notes
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);
}
```
Comment #1 by kinke — 2024-04-25T12:54:41Z
This is clearly invalid to me. A template param needs to be aliased to make it accessible from the outside, like `struct S(int a) { alias blub = a; }`.