[Issue 5685] [AA] Wrong code & accepted incavlid code using static array as key type in associative array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 9 00:28:56 PST 2014


https://d.puremagic.com/issues/show_bug.cgi?id=5685


Denis Shelomovskij <verylonglogin.reg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |verylonglogin.reg at gmail.com
            Summary|Static Arrays as AA indices |[AA] Wrong code & accepted
                   |                            |incavlid code using static
                   |                            |array as key type in
                   |                            |associative array
         OS/Version|Windows                     |All


--- Comment #1 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2014-03-09 12:28:53 MSK ---
This is `accepts-invalid` part of the issue. The following code compiles but
shouldn't just like in function call case:
---
void main()
{
    int[] a;
    int[int[1]] aa;
    const b = a in aa;
}
---


This is `wrong-code` part of the issue:
---
void main()
{
    int[1] a = [2];
    int[int[1]] aa;
    aa[a] = 3;
    assert([2] in aa); // fails
}
---

Here `[2]` isn't converted to static array but dynamic array address is passed
to `_aaInX` and the treated to be an address of a static array causing
undefined behavior.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list