[Issue 9957] [2.061 -> 2.062] Taking pointer of enum float array gives some garbage

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 23 19:28:55 PDT 2013


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



--- Comment #7 from Kenji Hara <k.hara.pg at gmail.com> 2013-04-23 19:28:53 PDT ---
(In reply to comment #6)
> I agree with Don. Enums do not have an address (even if under the hood they
> do). Users should use 'const' or 'immutable' if they need it to have an
> address.

OK. It's not bad design. But implementing it is not so easy. Because

1. Current dmd does not have such information internally. CTFE engine now uses
ownedByCtfe flag, but using it in semantic analysis is not intended.

2. It is not well designed enough. For example:

    enum float[] A = [1.0, 2.0, 3.0];
    auto a = A.ptr;  //?

In this case, the elements of A would be allocated on the runtime heap, or "not
addressable compile time memory"? Currently it operates as the former, but it
should be prohibited?

Anyway, doing all in 2.063 beta phase is difficult.

Therefore I'd like to propose that:
1. We once fix this "regression" and make the OP code workable in 2.063, by
merging my patch.
2. Later define the concept well and implement it.

How about?

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