View mode: basic / threaded / horizontal-split · Log in · Help
January 13, 2013
[Issue 9308] New: dynamic array's TypeInfo_Array.value is null of simple basic type

          Summary: dynamic array's TypeInfo_Array.value is null of simple
                   basic type
          Product: D
          Version: D2
         Platform: All
       OS/Version: All
           Status: NEW
         Severity: normal
         Priority: P2
        Component: DMD

--- Comment #0 from 2013-01-12 17:13:15 PST ---
if T is a simple(without const/immutable/...) basic(int/char/bool/real/...)
type, typeid(T[]).value is null.

for instance: typeid(int[]).value is null, it should be typeid(int).
p.s. typeid(string).value is null either.

test case(tested with DMD 2.060/2.061 for Win):
import std.stdio;

struct FooStruct {
   int a;

class FooClass {
   int b;

enum FooEnum {
   fe0, fe1, fe2

static string fooFn(string[] types...)
   string r = "";
   foreach(type; types)
       r ~= `writefln("%s\t%s\t%s\t%s", typeid(`
               ~type~`[]).value, typeid(immutable(`~type~`)[]).value,
               ~type~`)[]).value, typeid(shared(`~type~`)[]).value, );`~"\n";
   return r;

static auto testTypes()
   return fooFn(
       "int", "ubyte", "char", "wchar", "real", "bool", 
       "FooStruct", "FooClass", "FooEnum", 
       "string", "char[]", "char[char]", );

void main()
null    immutable(int)  const(int)  shared(int)
null    immutable(ubyte)    const(ubyte)    shared(ubyte)
null    null    const(char) shared(char)
null    immutable(wchar)    const(wchar)    shared(wchar)
null    immutable(real) const(real) shared(real)
null    immutable(bool) const(bool) shared(bool)
bug.FooStruct   immutable(bug.FooStruct)    const(bug.FooStruct)   
bug.FooClass    immutable(bug.FooClass) const(bug.FooClass)
bug.FooEnum immutable(bug.FooEnum)  const(bug.FooEnum)  shared(bug.FooEnum)
immutable(char)[]   immutable(immutable(char)[])    const(immutable(char)[])   
char[]  immutable(immutable(char)[])    const(const(char)[])   
char[char]  immutable(immutable(char)[char])    const(const(char)[char])   

Configure issuemail:
------- You are receiving this mail because: -------
Top | Discussion index | About this forum | D home