www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3692] New: Compiler with associative arrays when std.variant is imported

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3692

           Summary: Compiler with associative arrays when std.variant is
                    imported
           Product: D
           Version: 2.038
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: lmb stackedboxes.org



12:35:25 PST ---
First, I am using DMD 2.039, for which there is no entry on the "Version"
field. Anyway, I firstly bumped into this when using DMD 2.037.

So, when compiling this code:

import std.variant;

void main()
{
   bool[int] a;
   auto x = a.keys[0];
}

The compiler crashes saying:

        deferring sigaction_t
dmd: mtype.c:3882: StructDeclaration* TypeAArray::getImpl(): Assertion `impl'
failed.

---

Removing the 'import std.variant;' statement solves the problem.

Replacing the 'bool[int]' with 'int[int]' (and still importing std.variant)
makes the compiler say:

        deferring sigaction_t

But it still generates the executable, which seems to work as expected (that
is, throwing a "Range Violation").

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 08 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3692


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |DUPLICATE



*** This issue has been marked as a duplicate of issue 3552 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 08 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3692


Leandro Motta Barros <lmb stackedboxes.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
            Version|2.038                       |2.040
         Resolution|DUPLICATE                   |



04:18:36 PST ---
This bug has been marked as duplicate of issue 3552, so it should supposedly be
fixed in DMD 2.040. Unfortunately, it was not. Using DMD 2.040 to compile the
same code as before:

import std.variant;

void main()
{
   bool[int] a;
   auto x = a.keys[0];
}

I get the same compiler crash as before:

dmd: mtype.c:3886: StructDeclaration* TypeAArray::getImpl(): Assertion `impl'
failed.

So, unless I'm doing something very wrong here, I suppose this bug still
persists.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 05 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3692




04:42:50 PST ---
Just one additional detail:

In the program where I noticed this problem for the first time, as suggested by
others, I worked around the bug by using a copy of std.variant.d with all the
occurrences of "AssociativeArray" replaced with something else.

I tried going back to std.variant in my program, and the crash was still there.
In other words, it seems that the bug still has something to do with
identifiers named "AssociativeArray".


(That said, this code:

void main()
{    
    int AssociativeArray;        
    int[int] foo;    
    foreach (x; foo)    {    }
}

which I took from issue 3552, compiles cleanly here, which seems to indicate
that I am *really* running DMD 2.040 here ;-))

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 05 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3692





 Just one additional detail:
 
 In the program where I noticed this problem for the first time, as suggested by
 others, I worked around the bug by using a copy of std.variant.d with all the
 occurrences of "AssociativeArray" replaced with something else.
 
 I tried going back to std.variant in my program, and the crash was still there.
 In other words, it seems that the bug still has something to do with
 identifiers named "AssociativeArray".
Yes. Reduced test case: --------- import file2; void main() { bool[int] a; auto x = a.keys[0]; } ------- file2: -------- int AssociativeArray; ------------------------------ Basically my patch fixed the specific case of bug 3552 but failed in the general case. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 05 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3692


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code, patch
           Severity|normal                      |regression



PATCH: mtype.c line 3870

-        // Create .AssociativeArray!(index, next)
+        // Create object.AssociativeArray!(index, next)
        DotTemplateInstanceExp *dti = new DotTemplateInstanceExp(loc,
-            new IdentifierExp(loc, Id::empty),
+            new IdentifierExp(loc, Id::object),
            Id::AssociativeArray,
            tiargs);

Or possibly it should be .object.AssociativeArray

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 05 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3692


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



22:25:50 PST ---
Changeset 377

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 11 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3692


Kosmonaut <Kosmonaut tempinbox.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Kosmonaut tempinbox.com



---

 Changeset 377
http://www.dsource.org/projects/dmd/changeset/377 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 12 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3692


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED



22:27:23 PST ---
Fixed dmd 2.041

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