January 13, 2013 [Issue 9308] New: dynamic array's TypeInfo_Array.value is null of simple basic type | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=9308 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 AssignedTo: nobody@puremagic.com ReportedBy: egustc@gmail.com --- Comment #0 from egustc@gmail.com 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, typeid(const(` ~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() { mixin(testTypes()); } ============= 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) shared(bug.FooStruct) bug.FooClass immutable(bug.FooClass) const(bug.FooClass) shared(bug.FooClass) bug.FooEnum immutable(bug.FooEnum) const(bug.FooEnum) shared(bug.FooEnum) immutable(char)[] immutable(immutable(char)[]) const(immutable(char)[]) shared(immutable(char)[]) char[] immutable(immutable(char)[]) const(const(char)[]) shared(shared(char)[]) char[char] immutable(immutable(char)[char]) const(const(char)[char]) shared(shared(char)[char]) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation