www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4289] New: template struct opEquals problem

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

           Summary: template struct opEquals problem
           Product: D
           Version: future
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc



The syntax of this D2 code seems correct (removing the const this code used to
work in D1):


struct Foo(size_t N) {
    bool opEquals(ref const(Foo!(N))) const {
        return false;
    }
}
alias Foo!(2) Foo2;
void main() {}



But DMD v2.046 prints at compile-time:

test.d(2): Error: function test.Foo!(2).Foo.opEquals type signature should be
const bool(ref const(Foo!(2))) not const bool(ref const(Foo!(N)))
test.d(6): Error: template instance test.Foo!(2) error instantiating

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE



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

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




Turns out this is completely unrelated to bug 3607. And it actually has nothing
to do with opEquals, either!

Change the test case from this:
alias Foo!(2) Foo2;
to this:
alias Foo!(2u) Foo2;
and it compiles!!!

This is the same issue as bug 2257.

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

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