www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12267] New: [REG 2.065] Using struct as AA key sometimes require opCmp

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

           Summary: [REG 2.065] Using struct as AA key sometimes require
                    opCmp
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: doob me.com



There's a struct declared in Tango [1] as follows:

struct TagIndex
{
    uint tag;
    uint index;
}

The above should not need to define a custom opCmp to be used as an AA key.
Unfortunately I haven't been able to find a reduced test case.

[1]
https://github.com/SiegeLord/Tango-D2/blob/94471d6b5282dde78fae8be7924fe3fa389c1900/tango/text/Regex.d#L2366-L2385

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 26 2014
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12267


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |thecybershadow gmail.com
         Resolution|                            |DUPLICATE



08:07:44 EET ---

 Unfortunately I haven't been able to find a reduced test case.
Um? struct S {} int[S] aa; That's your reduced test case right there. Compiles in 2.064.2 but not 2.065.0. Anyway, this has already been filed as issue 12255. *** This issue has been marked as a duplicate of issue 12255 *** -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 26 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12267




I'm pretty sure that the simple case with two uints did compile in 2.065. But
not the case in Tango.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 26 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12267




09:18:34 EET ---
That's not what I'm seeing:

C:\Temp\D\issues\12267>
"C:\Downloads\!dmd\dmd.2.065.0\dmd2\windows\bin\dmd.exe" -o- test.d
test.d(2): Error: associative array key type S does not have 'const int
opCmp(ref const S)' member function

Please check again. If the simple case above compiles for you, please post the
exact compiler version, operating system, etc.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 26 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12267





 That's not what I'm seeing:
 
 C:\Temp\D\issues\12267>
 "C:\Downloads\!dmd\dmd.2.065.0\dmd2\windows\bin\dmd.exe" -o- test.d
 test.d(2): Error: associative array key type S does not have 'const int
 opCmp(ref const S)' member function
 
 Please check again. If the simple case above compiles for you, please post the
 exact compiler version, operating system, etc.
If I import std.stdio it compiles. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 27 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12267




22:48:44 EET ---
Well, isn't this interesting.

This compiles:

struct T { int opCmp() { return 2; } }

struct S {}
int[S] aa;


That is, it is enough to add an opCmp to ANY struct to unbreak compilation.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 27 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12267





 Well, isn't this interesting.
 
 This compiles:
 
 struct T { int opCmp() { return 2; } }
 
 struct S {}
 int[S] aa;
 
 
 That is, it is enough to add an opCmp to ANY struct to unbreak compilation.
Haha, that's weird. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 27 2014