[Issue 8657] TypeInfo generated for const/immutable static arrays not transitive

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 16 04:46:23 PDT 2012


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



--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2012-09-16 04:47:16 PDT ---
(In reply to comment #0)
[snip]
> It shows that the next and base properties of the TypeInfo generated for
> const(int[2]) and immutable(int[2]) lose the qualifier. This does not happen
> for "shared".

I think this is expected behavior, because const(int[2]) is value type.

TypeInfo_Const.next specifies the TypeInfo object of the type that removed head
const qualifier from original type.
And, Removing const from const(int[2]) is int[2], not const(int)[2].
It's just same as std.traits.Unqual.

  pragma(msg, Unqual!(const(int[2])));  // prints const(int)[]
  pragma(msg, Unqual!(const(int[2])));  // prints int[2]

Additionally, const(int)[2] is same as const(int[2]). There is just a
syntactically difference.

  alias const(int)[2] T1;
  alias const(int[2]) T2;
  static assert(is(T1 == T2));  // they are same
  pragma(msg, T1);   // prints const(int[2])
  pragma(msg, T2);   // prints const(int[2])

-- 
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