[Issue 9186] Manifest constant can violate const correctness restrictions when empty
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Dec 21 00:30:30 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9186
--- Comment #3 from Kenji Hara <k.hara.pg at gmail.com> 2012-12-21 00:30:27 PST ---
This is not a type system problem.
All manifest constants, which declared by `enum` and T.init, make literal
expressions in the places where they used.
alias T = string[];
enum T strs = [[]];
foo(T.init); // same as foo(null);
foo(strs); // same as foo([[]]);
And, empty array literal and null literal can ignore their type qualifiers in
constant-folding process, because they have no references to qualified values.
(From the view of compiler development, it is mainly designed by
Expression::implicitConvTo.)
I can agree that the behavior is not intuitive, but I'm not sure what is the
correct behavior...
--
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