D.gnu - GDC doesn't catch this ambiguity
- Mike (69/69) Jan 10 2014 In the following code:
- Mike (8/77) Jan 10 2014 LDC
- Iain Buclaw (2/9) Jan 11 2014 GDC is on 2.064.2, which uses a newer frontend than LDC.
In the following code: module trace; private nothrow pure void SendCommand(in int command, in void* message) { asm { "mov r0, %[cmd]; mov r1, %[msg]; : : [cmd] "r" command, [msg] "r" message : "r0", "r1"; }; } private static nothrow pure void SendMessage(in void* ptr, in uint length) { // Create semihosting message message uint[3] message = [ 2, // stderr cast(uint)ptr, // ptr to string length // size of string ]; // Send semihosting command SendCommand(0x05, &message); } struct Trace { static nothrow pure void Write(in string text) { SendMessage(text.ptr, text.length); } static nothrow pure void Write(uint value) { char[32] buffer; char* p = buffer.ptr + 31; do { p--; *p = '0' + (value % 10); value /= 10; } while(value > 0); SendMessage(p, (buffer.ptr + 31) - p); } static nothrow pure void Write(A...)(A a) { foreach(t; a) { Write(t); } } static nothrow pure void WriteLine(A...)(A a) { foreach(t; a) { Write(t); } Write("\r\n"); } } GDC doesn't catch the ambiguity between... static nothrow pure void Write(A...)(A a) and static nothrow pure void Write(in string text) ... but LDC does. Who's right?
Jan 10 2014
On Saturday, 11 January 2014 at 00:45:20 UTC, Mike wrote:In the following code: module trace; private nothrow pure void SendCommand(in int command, in void* message) { asm { "mov r0, %[cmd]; mov r1, %[msg]; : : [cmd] "r" command, [msg] "r" message : "r0", "r1"; }; } private static nothrow pure void SendMessage(in void* ptr, in uint length) { // Create semihosting message message uint[3] message = [ 2, // stderr cast(uint)ptr, // ptr to string length // size of string ]; // Send semihosting command SendCommand(0x05, &message); } struct Trace { static nothrow pure void Write(in string text) { SendMessage(text.ptr, text.length); } static nothrow pure void Write(uint value) { char[32] buffer; char* p = buffer.ptr + 31; do { p--; *p = '0' + (value % 10); value /= 10; } while(value > 0); SendMessage(p, (buffer.ptr + 31) - p); } static nothrow pure void Write(A...)(A a) { foreach(t; a) { Write(t); } } static nothrow pure void WriteLine(A...)(A a) { foreach(t; a) { Write(t); } Write("\r\n"); } } GDC doesn't catch the ambiguity between... static nothrow pure void Write(A...)(A a) and static nothrow pure void Write(in string text) ... but LDC does. Who's right?LDC the LLVM D compiler (0.12.1): based on DMD v2.063.2 and LLVM 3.3 GDC arm-none-eabi-gdc (GCC) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. Also, is there a way to know which version of DMD GDC is based on?
Jan 10 2014
On 11 January 2014 01:13, Mike <none none.com> wrote:LDC the LLVM D compiler (0.12.1): based on DMD v2.063.2 and LLVM 3.3 GDC arm-none-eabi-gdc (GCC) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. Also, is there a way to know which version of DMD GDC is based on?GDC is on 2.064.2, which uses a newer frontend than LDC.
Jan 11 2014
On Saturday, 11 January 2014 at 12:39:59 UTC, Iain Buclaw wrote:On 11 January 2014 01:13, Mike <none none.com> wrote::~$ gdc --version gdc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. That probably was a feature request on the output of gdc --version to list "based on DMD 2.064.2"LDC the LLVM D compiler (0.12.1): based on DMD v2.063.2 and LLVM 3.3 GDC arm-none-eabi-gdc (GCC) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. Also, is there a way to know which version of DMD GDC is based on?GDC is on 2.064.2, which uses a newer frontend than LDC.
Jan 11 2014
On Saturday, 11 January 2014 at 12:39:59 UTC, Iain Buclaw wrote:On 11 January 2014 01:13, Mike <none none.com> wrote: GDC doesn't catch the ambiguity between... static nothrow pure void Write(A...)(A a) and static nothrow pure void Write(in string text) ... but LDC does. Who's right?GDC is on 2.064.2, which uses a newer frontend than LDC.So is difference in frontends the reason for the difference between the two compilers in this case?
Jan 11 2014
On Saturday, 11 January 2014 at 23:12:52 UTC, Mike wrote:On Saturday, 11 January 2014 at 12:39:59 UTC, Iain Buclaw wrote:I'm guess this changed explains the difference. http://dlang.org/changelog.html#template_overload_setOn 11 January 2014 01:13, Mike <none none.com> wrote: GDC doesn't catch the ambiguity between... static nothrow pure void Write(A...)(A a) and static nothrow pure void Write(in string text) ... but LDC does. Who's right?GDC is on 2.064.2, which uses a newer frontend than LDC.So is difference in frontends the reason for the difference between the two compilers in this case?
Jan 11 2014