www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1715] New: Template specialization checks for equality rather than convertibility

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

           Summary: Template specialization checks for equality rather than
                    convertibility
           Product: D
           Version: 2.008
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: rejects-valid, spec
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: dhasenan gmail.com


This is related to #1714: the workaround for 1714 is prevented by this, and
vice versa.

When specializing a template based on the template parameters of its argument,
a check is performed for equality, not convertibility. For every other type
specialization, a check is performed for convertibility rather than equality.
(Equality would be redundant in those situations, and pretty much every
situation.)

Example:
---
class Foo(T){}
class Bar : Foo!(int) {}
template GetFooArg (T : Foo!(U), U) {
   alias U GetFooArg;
}

static assert (is (GetFooArg!(Foo!(int)) == int)); // works
static assert (is (GetFooArg!(Bar) == int)); // false
pragma (msg, GetFooArg!(Bar).stringof); // template instance GetFooArg!(Bar) 
// does not match any template declaration
---


-- 
Dec 04 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1715


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |clugdbug yahoo.com.au


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-09-03 11:26:31 PDT ---
The patch in bug 4173 fixes this.

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2010-09-11
17:52:32 PDT ---
http://www.dsource.org/projects/dmd/changeset/675

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


Mike Linford <mike.linford gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mike.linford gmail.com
         Resolution|FIXED                       |INVALID


--- Comment #3 from Mike Linford <mike.linford gmail.com> 2010-09-15 23:52:54
PDT ---
(In reply to comment #2)
 http://www.dsource.org/projects/dmd/changeset/675

DMD 1.063 gives the same results for the given example and an example in my personal code. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 15 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1715


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |FIXED


--- Comment #4 from Don <clugdbug yahoo.com.au> 2010-09-16 00:09:24 PDT ---
(In reply to comment #3)
 (In reply to comment #2)
 http://www.dsource.org/projects/dmd/changeset/675

DMD 1.063 gives the same results for the given example and an example in my personal code.

Yes, of course. Why did you mark this as invalid???? The bug is definitely valid, and it's fixed in the upcoming beta. Please don't do this sort of thing again. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 16 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1715



--- Comment #5 from Mike Linford <mike.linford gmail.com> 2010-09-16 09:34:29
PDT ---
(In reply to comment #4)
 (In reply to comment #3)
 (In reply to comment #2)
 http://www.dsource.org/projects/dmd/changeset/675

DMD 1.063 gives the same results for the given example and an example in my personal code.

Yes, of course. Why did you mark this as invalid???? The bug is definitely valid, and it's fixed in the upcoming beta. Please don't do this sort of thing again.

I guess I'm confused. It's claimed that the bug was resolved, but the latest version has the bug. Since the latest version in fact hasn't resolved the bug, doesn't that mean that the resolution was invalid? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 16 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1715



--- Comment #6 from Don <clugdbug yahoo.com.au> 2010-09-17 01:26:19 PDT ---
(In reply to comment #5)
 (In reply to comment #4)
 (In reply to comment #3)
 (In reply to comment #2)
 http://www.dsource.org/projects/dmd/changeset/675

DMD 1.063 gives the same results for the given example and an example in my personal code.

Yes, of course. Why did you mark this as invalid???? The bug is definitely valid, and it's fixed in the upcoming beta. Please don't do this sort of thing again.

I guess I'm confused. It's claimed that the bug was resolved, but the latest version has the bug. Since the latest version in fact hasn't resolved the bug, doesn't that mean that the resolution was invalid?

1.063 is not the latest version. (BTW, if the bug was still not fixed, you'd mark it as 'REOPENED' not INVALID). Bugs get marked as fixed when they are fixed in svn, not when a release happens (the inability to distinguish between the two is something I intensely dislike about Bugzilla). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 17 2010