[phobos] [D-Programming-Language/phobos] 4e1b8d: std.variant: don't assert that target address != n...

GitHub via phobos phobos at puremagic.com
Sat Oct 17 19:09:50 PDT 2015


  Branch: refs/heads/master
  Home:   https://github.com/D-Programming-Language/phobos
  Commit: 4e1b8dcc212367cbda4b3418bcf118d84254a760
      https://github.com/D-Programming-Language/phobos/commit/4e1b8dcc212367cbda4b3418bcf118d84254a760
  Author: Martin <noone at nowhere.com>
  Date:   2015-10-09 (Fri, 09 Oct 2015)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  std.variant: don't assert that target address != null if type size is 0

A unittest triggers in line 1918 when testing Variant!(void[0]) with LDC
(current merge-2.068 branch).

When taking the address of a truly empty type, such as T[0], LDC always
returns a null constant; nothing is allocated on the stack.
Disabling this assert in case the target type's size is 0 should be safe,
there's no private state which could be modified by the following
assignment (it may still have side effects though) - right? ;)


  Commit: ca01aeeb83744061bf3c1d64c590a59cbef70c1a
      https://github.com/D-Programming-Language/phobos/commit/ca01aeeb83744061bf3c1d64c590a59cbef70c1a
  Author: Vladimir Panteleev <github.private at thecybershadow.net>
  Date:   2015-10-18 (Sun, 18 Oct 2015)

  Changed paths:
    M std/variant.d

  Log Message:
  -----------
  Merge pull request #3708 from kinke/variant

std.variant: don't assert that target address != null if type size is 0


Compare: https://github.com/D-Programming-Language/phobos/compare/6ee65f477cc0...ca01aeeb8374


More information about the phobos mailing list