Bug 14830 – RefCounted and Unique do not forward all fields of underlying data structure

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2015-07-26T11:43:51Z
Last change time
2024-12-01T16:24:53Z
Assigned to
No Owner
Creator
Joseph Rushton Wakeling
Moved to GitHub: phobos#10137 →

Comments

Comment #0 by joseph.wakeling — 2015-07-26T11:43:51Z
Observed when trying to create a ref-counted random number generator: import std.random, std.typecons; static assert(isUniformRNG!Random); static assert(isUniformRNG!(RefCounted!Random)); // FAILS So far as I can tell, the problem is the check for the existence of the isUniformRandom boolean enum in the isUniformRNG template check: https://github.com/D-Programming-Language/phobos/blob/master/std/random.d#L137-L140 i.e. while this check passes: static assert(is(typeof(Random.isUniformRandom))); this corresponding one fails: static assert(is(typeof((RefCounted!Random).isUniformRandom))); Clearly one could put the blame on the isUniformRNG template check here, but my feeling is that RefCounted should be able to forward _all_ properties and fields of the underlying type, including compile-time enum flags like isUniformRandom.
Comment #1 by joseph.wakeling — 2015-07-26T11:45:13Z
See also Issue #10888. Both these issues have nasty consequences for working with std.random functionality.
Comment #2 by joseph.wakeling — 2015-07-26T12:20:22Z
Same happens with Unique!Random: static assert(isUniformRNG!(Unique!Random)); // FAILS
Comment #3 by robert.schadek — 2024-12-01T16:24:53Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10137 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB