Bug 15978 – Can't pass vector type .init property as template parameter

Status
NEW
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-05-01T12:16:40Z
Last change time
2024-12-13T18:47:40Z
Assigned to
No Owner
Creator
Lass Safin
Moved to GitHub: dmd#19120 →

Comments

Comment #0 by lasssafin — 2016-05-01T12:16:40Z
template MyTemplate(alias parameter) {} alias MyVec = __vector(float[4]); //x.d(6): Error: expression cast(__vector(float[4]))[nanF, nanF, nanF, nanF] is not a valid template value argument //alias _ = MyTemplate!(MyVec.init); //x.d(8): Error: found '.' when expecting ')' following template argument list //x.d(8): Error: unexpected identifer 'init' in declarator //x.d(8): Error: semicolon expected to close alias declaration //x.d(8): Error: declaration expected, not ')' //alias __ = MyTemplate!(__vector(float[4]).init);
Comment #1 by nick — 2023-02-19T21:33:54Z
Not just __vector: alias a = MyTemplate!(int.init); // OK alias a = MyTemplate!(int[].init); // NG alias a = MyTemplate!(int[4].init); // NG
Comment #2 by nick — 2024-09-02T11:20:57Z
> alias a = MyTemplate!(int[].init); // NG That one works as of 2.102.2. > alias a = MyTemplate!(int[4].init); // NG That one is still a parse error, but I filed it separately as issue 24740 as it applies to other contexts too.
Comment #3 by robert.schadek — 2024-12-13T18:47:40Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19120 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB