Bug 16630 – Compile errors with std.traits.arity and std.traits.ParameterStorageClassTuple
Status
RESOLVED
Resolution
WORKSFORME
Severity
major
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2016-10-21T04:03:00Z
Last change time
2017-04-04T10:50:12Z
Assigned to
lucia.mcojocaru
Creator
goldmax3000
Comments
Comment #0 by goldmax3000 — 2016-10-21T04:03:06Z
This code
import std.traits;
class X
{
@property auto prop() const
{
struct Iter {}
return Iter();
}
}
pragma(msg, ParameterStorageClassTuple!(X.prop));
gives compile error:
/opt/compilers/dmd2/include/std/traits.d(1016): Error: string slice [1 .. 0] is out of bounds
/opt/compilers/dmd2/include/std/traits.d(1016): Error: string slice [1 .. 0] is out of bounds
/d57/f615.d(11): Error: template instance std.traits.ParameterStorageClassTuple!(prop) error instantiating
/d57/f615.d(11): while evaluating pragma(msg, ParameterStorageClassTuple!(prop))
Similar error with pragma(msg, arity!(X.prop));
/opt/compilers/dmd2/include/std/traits.d(1699): Error: string index 0 is out of bounds [0 .. 0]
/opt/compilers/dmd2/include/std/traits.d(1699): Error: string index 0 is out of bounds [0 .. 0]
/opt/compilers/dmd2/include/std/traits.d(1751): Error: template instance std.traits.functionLinkage!() error instantiating
/opt/compilers/dmd2/include/std/traits.d(970): instantiated from here: variadicFunctionStyle!(prop)
/opt/compilers/dmd2/include/std/traits.d(1756): Error: string index 18446744073709551593 is out of bounds [0 .. 0]
/opt/compilers/dmd2/include/std/traits.d(1756): Error: array index -23 is out of bounds [0..0]
/d112/f0.d(11): while looking for match for arity!(prop)
/d112/f0.d(11): while evaluating pragma(msg, arity!(prop))
Comment #1 by lucia.mcojocaru — 2017-04-04T10:49:46Z
I've justed tested the given example with the current version (on master branch) of dmd/druntime/phobos and there are no compilation errors. Compilation was done on Linux 64bit, just as the bug indicates.
I will close this issue for the time being. If anybody is able to reproduce this, please reopen it.