[Issue 8486] Possibly wrong interaction of Variant and const arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 1 12:58:18 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8486



--- Comment #3 from cybevnm <cybevnm at gmail.com> 2012-08-01 12:58:14 PDT ---
(In reply to comment #2)
> … the point being that this is, if anything, analogous to the constness of the
> Variant instance itself, not the contained type.

Unfortunately, Variant's handling of arrays is different to handling of class
references. So we have next situtation:

import std.variant;
class C { }
void main()
{
  {
    const C c;
    Variant v = Variant( c );
    assert( v.peek!( typeof(c) )() != null );
  }
  {
    const C[] cs;
    Variant v = Variant( cs );
    assert( v.peek!( typeof(cs) )() == null );
 }
}
But array top-level const cutting is understandable, it's the way it works in
all other places...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list