Bug 1715 – Template specialization checks for equality rather than convertibility

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2007-12-04T21:22:00Z
Last change time
2015-06-09T01:14:23Z
Keywords
patch, rejects-valid, spec
Assigned to
nobody
Creator
dhasenan

Comments

Comment #0 by dhasenan — 2007-12-04T21:22:16Z
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 ---
Comment #1 by clugdbug — 2010-09-03T11:26:31Z
The patch in bug 4173 fixes this.
Comment #2 by bugzilla — 2010-09-11T17:52:32Z
Comment #3 by mike.linford — 2010-09-15T23:52:54Z
(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.
Comment #4 by clugdbug — 2010-09-16T00:09:24Z
(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.
Comment #5 by mike.linford — 2010-09-16T09:34:29Z
(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?
Comment #6 by clugdbug — 2010-09-17T01:26:19Z
(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).