Skip to content

Commit 0fbd57c

Browse files
committed
make Proxy.accessibleFrom() work with 'scope' inference
1 parent 96f092b commit 0fbd57c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

std/typecons.d

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5137,8 +5137,14 @@ RefCounted!(T, RefCountedAutoInitialize.no) refCounted(T)(T val)
51375137
mixin template Proxy(alias a)
51385138
{
51395139
private alias ValueType = typeof({ return a; }());
5140+
5141+
/* Determine if 'T.a' can referenced via a const(T).
5142+
* Use T* as the parameter because 'scope' inference needs a fully
5143+
* analyzed T, which doesn't work when accessibleFrom() is used in a
5144+
* 'static if' in the definition of Proxy or T.
5145+
*/
51405146
private enum bool accessibleFrom(T) =
5141-
is(typeof((ref T self){ cast(void)mixin("self."~__traits(identifier, a)); }));
5147+
is(typeof((T* self){ cast(void)mixin("(*self)."~__traits(identifier, a)); }));
51425148

51435149
static if (is(typeof(this) == class))
51445150
{

0 commit comments

Comments
 (0)