Skip to content

Commit

Permalink
Merge pull request #7122 from tchaloupka/systimelocalaliasing
Browse files Browse the repository at this point in the history
Fix issue 20097
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>
  • Loading branch information
dlang-bot committed Aug 4, 2019
2 parents f54c9fc + 267c2aa commit 225a6af
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions std/concurrency.d
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,16 @@ private
{
bool hasLocalAliasing(Types...)()
{
import std.typecons : Rebindable;

// Works around "statement is not reachable"
bool doesIt = false;
static foreach (T; Types)
{
static if (is(T == Tid))
{ /* Allowed */ }
else static if (is(T : Rebindable!R, R))
doesIt |= hasLocalAliasing!R;
else static if (is(T == struct))
doesIt |= hasLocalAliasing!(typeof(T.tupleof));
else
Expand All @@ -94,6 +98,14 @@ private
static assert(!hasLocalAliasing!(Tid, Container, int));
}

@safe unittest
{
/* Issue 20097 */
import std.datetime.systime : SysTime;
static struct Container { SysTime time; }
static assert(!hasLocalAliasing!(SysTime, Container));
}

enum MsgType
{
standard,
Expand Down

0 comments on commit 225a6af

Please sign in to comment.