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


--- Comment #0 from bearophile_hugs eml.cc 2010-06-06 12:30:50 PDT ---
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


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-09-22 03:40:56 PDT ---
*** 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



--- Comment #2 from Don <clugdbug yahoo.com.au> 2010-12-01 02:29:17 PST ---
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