[Issue 567] New: Compiler crash with conflicting templates
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Nov 18 11:12:20 PST 2006
http://d.puremagic.com/issues/show_bug.cgi?id=567
Summary: Compiler crash with conflicting templates
Product: D
Version: 0.174
Platform: PC
URL: http://www.digitalmars.com/d/templates-revisited.html
OS/Version: Windows
Status: NEW
Keywords: ice-on-valid-code, rejects-valid
Severity: major
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: deewiant at gmail.com
The code below is directly from the "Specialization" section in the spec, with
only empty template bodies and aliases added to make it syntactically valid.
Evidently (according to the spec and the comments) this should work, so there
shouldn't be a conflict:
template Foo(T) {}
template Foo(T:T*) {}
template Foo(T, T) {}
template Foo(T, U) {}
template Foo(T, U:int) {}
alias Foo!(long) a; // picks Foo(T)
alias Foo!(long[]) b; // picks Foo(T), T is long[]
alias Foo!(int*) c; // picks Foo(T*), T is int
alias Foo!(long,long) d; // picks Foo(T, T)
alias Foo!(long,short) e; // picks Foo(T, U)
alias Foo!(long,int) f; // picks Foo(T, U:int)
alias Foo!(int,int) g; // ambiguous - Foo(T, T)
// or Foo(T, U:int)
DMD crashes on the above after emitting the following:
asdf.d(4): template asdf.Foo(T,U) conflicts with asdf.Foo(T) at asdf.d(1)
--
More information about the Digitalmars-d-bugs
mailing list