Bug 20087 – `scope` not parsed for types in template argument lists

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-07-27T04:07:42Z
Last change time
2023-02-19T21:29:41Z
Assigned to
No Owner
Creator
Mike Franklin

Comments

Comment #0 by slavo5150 — 2019-07-27T04:07:42Z
``` template __externC(RT, P...) { alias __externC = extern(C) RT function(P); } extern(C) void* test(scope const char*); static assert(is(typeof(&test) == __externC!(void*, scope const char*))); ``` Last line fails with: Error: expression expected, not scope Error: found const when expecting ) following template argument list Error: found char when expecting ) Error: expression expected, not ) Error: found ) when expecting ;
Comment #1 by pro.mathias.lang — 2019-07-27T12:13:06Z
`scope` is a storage class, not a type modifier. So no, this code should not be valid. You can replace `scope` with `static` for a more "natural" example of the issue.