digitalmars.D - Unjustified conflict ( I guess ^^ )
- funog (11/11) Dec 19 2007 I have posted this one on digitalmars.D.bugs, but somehow I feel it wasn...
- Unknown W. Brackets (13/31) Dec 19 2007 The trouble is, they're not both functions or both templates, which is
- Jarrett Billingsley (6/20) Dec 19 2007 As Mr. Brackets explained it's because they're not both templates or bot...
I have posted this one on digitalmars.D.bugs, but somehow I feel it wasn't the right place ... dmd1.023 ( can't try with 1.024 or 2.008 as I don't have glibc 2.4 ... it's really sad I can't try the new const/invariant :( ) doesn't compile : void foo(T)(out T[] p) { //... } void foo(out int p) { //... } test.d(7): function test.foo conflicts with template test.foo(T) at test.d(2) I can't see a conflict ... Am I missing something ?
Dec 19 2007
The trouble is, they're not both functions or both templates, which is why it's giving you this. In other words, it's more steps than you're imagining: Step 1. Find the symbol (foo the template or foo the function?) Step 2. If the symbol is a template, automatically deduce types (only after we've picked it.) Step 3. Pick the best overload and make sure there's no conflicts. If it were two steps, where it deduces types for all possible templates, flattens them and compares all equally... then this would work. As is, you'll have to use alias to make this work, or perhaps make them both use templates (though I'm not sure that will work.) -[Unknown] funog wrote:I have posted this one on digitalmars.D.bugs, but somehow I feel it wasn't the right place ... dmd1.023 ( can't try with 1.024 or 2.008 as I don't have glibc 2.4 ... it's really sad I can't try the new const/invariant :( ) doesn't compile : void foo(T)(out T[] p) { //... } void foo(out int p) { //... } test.d(7): function test.foo conflicts with template test.foo(T) at test.d(2) I can't see a conflict ... Am I missing something ?
Dec 19 2007
"funog" <funog ifrance.com> wrote in message news:fkal3f$2utu$1 digitalmars.com...I have posted this one on digitalmars.D.bugs, but somehow I feel it wasn't the right place ... dmd1.023 ( can't try with 1.024 or 2.008 as I don't have glibc 2.4 ... it's really sad I can't try the new const/invariant :( ) doesn't compile : void foo(T)(out T[] p) { //... } void foo(out int p) { //... } test.d(7): function test.foo conflicts with template test.foo(T) at test.d(2)As Mr. Brackets explained it's because they're not both templates or both functions, but it'll make you happy to know that this is expected to work in D2 (eventually, it hasn't been implemented yet but Walter said that it would).
Dec 19 2007