[Issue 14189] New: can't declare two identical function prototypes

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14189

  Issue ID: 14189
   Summary: can't declare two identical function prototypes
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: ket...@ketmar.no-ip.org

this code fails to compile:

=== test.d ===
void foo ();
void foo ();
==

but why? there is nothing wrong with declaring two identical *prototypes*.
compiler must forbid declaring two identical function *implementations* (i.e.
two functions with same signature and both with body), but there is no sense in
forbidding identical prototypes.

this also breaks win32 API headers (oleauto.d, for example). and any other
project which declares prototypes more than once.

this will not help catching any bugs too, so it seems that this is just a
needless restriction.

--


[Issue 13009] [REG2.064] inout overload conflicts with non-inout when used via alias this

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13009

Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||pull

--- Comment #9 from Kenji Hara k.hara...@gmail.com ---
https://github.com/D-Programming-Language/dmd/pull/4417

--


[Issue 14188] New: Add gcc-equivalent -MD options to dmd

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14188

  Issue ID: 14188
   Summary: Add gcc-equivalent -MD options to dmd
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: atila.ne...@gmail.com

gcc can output Makefile-compatible dependency files with the -MD -MF combo, or
-MMD -MF which leaves out system files (such as stdio.h). dmd has -deps, but
the output format is unusable by GNU make and requires transformation.

This feature is necessary in order to have Make and Ninja compatible dependency
generation done by the compiler.

--


[Issue 14190] New: Overload sets example incorrect

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14190

  Issue ID: 14190
   Summary: Overload sets example incorrect
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: spec
  Severity: normal
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: thecybersha...@gmail.com

http://dlang.org/function.html#overload-sets specifies the following example:

/// A.d //
module A;
void foo() { }
void foo(long i) { }
/// B.d //
module B;
class C { }
void foo(C) { }
void foo(int i) { }
/ test.d /
import A;
import B;

void bar(C c)
{
foo();// calls A.foo()
foo(1L);  // calls A.foo(long)
foo(c);   // calls B.foo(C)
foo(1,2); // error, does not match any foo
foo(1);   // error, matches A.foo(long) and B.foo(int)
A.foo(1); // calls A.foo(long)
}
//

However, the line:

foo(1L);  // calls A.foo(long)

doesn't actually work:

test.d(7): Error: B.foo at B.d(4) conflicts with A.foo at A.d(3)

--


[Issue 7436] ICE(cg87.c) ubyte = ubyte op= float

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7436

Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #4 from Kenji Hara k.hara...@gmail.com ---
Not all cases are fixed. See the disabled test cases in
test/compilable/testexpression.d.

--


[Issue 14189] can't declare two identical function prototypes

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14189

Ketmar Dark ket...@ketmar.no-ip.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||ket...@ketmar.no-ip.org
 Resolution|--- |INVALID

--- Comment #1 from Ketmar Dark ket...@ketmar.no-ip.org ---
sorry, that was a bugreport for unmerged PR.

--


[Issue 2789] Functions overloads are not checked for conflicts

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2789

--- Comment #12 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/41f243a6c29f00ab4cdeb69d418796ed00fa0c51
Supplemental fix for issue 2789

https://github.com/D-Programming-Language/phobos/commit/122f7ca5ecfbb58234ae0dac3113d420b64f62a5
Merge pull request #2968 from 9rnsr/fix2789

Supplemental fix for issue 2789

--


[Issue 14186] Silent syntax change from C and C++

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14186

--- Comment #6 from ag0ae...@gmail.com ---
(In reply to Sobirari Muhomori from comment #5)
 Looks like gcc has some history under this issue:
 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=6905

That ticket is about C++ though. But if C99 changed/clarified the operator
precedence, gcc seems to be buggy in that regard.

For D that raises the question what version of C we're aiming for. KR C,
contemporary ANSI C, C as popular compilers understand it, ...?

--


[Issue 12500] ICE in codegen when multiplying an incremented size_t by a double

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12500

Andrej Mitrovic andrej.mitrov...@gmail.com changed:

   What|Removed |Added

 CC|andrej.mitrov...@gmail.com  |

--


[Issue 13834] make levenshteinDistance @nogc

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13834

--- Comment #1 from Martin Nowak c...@dawg.eu ---
Implementing the more space efficient variant of the algorithm when the final
path isn't needed is another optimization.
http://en.wikipedia.org/wiki/Levenshtein_distance#Iterative_with_two_matrix_rows

--


[Issue 4764] Lazy versions of std.string.split and std.string.splitlines

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=4764

Nick Treleaven ntrel-...@mybtinternet.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Nick Treleaven ntrel-...@mybtinternet.com ---
Closing - a pull has been merged adding splitterLines:
https://github.com/D-Programming-Language/phobos/pull/2987

--


[Issue 13920] DMD crash when trying to set a delegate from __traits(getOverloads)

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13920

bb.t...@gmx.com changed:

   What|Removed |Added

   Assignee|nob...@puremagic.com|k.hara...@gmail.com

--


[Issue 14191] New: Failure to locate overload with template this parameter

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14191

  Issue ID: 14191
   Summary: Failure to locate overload with template this
parameter
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: blocker
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: blah38...@gmail.com

The following code fails to compile with:
Error: template main.C.myTemplate2 cannot deduce function from argument types
!()(int), candidates are:
main.C.myTemplate2(this P, T)(T val)


And the code:

void main(string[] args)
{
D.myTemplate3(0);
}

class C
{
static void myTemplate2(this P, T)(T val)
{
P.myTemplate(val);
}
}

class D : C
{
static void myTemplate3(T)(T val)
{
myTemplate2(val);
}

static void myTemplate(T)(T val)
{

}
}


Removing `this P` from the template parameter list of `myTemplate2` allows it
to compile, but doesn't give access to `myTemplate`.

This makes it very difficult to abstract out templated code into a base class
that is dependent upon the implementation in the derived class.

--


[Issue 13920] DMD crash when trying to set a delegate from __traits(getOverloads)

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13920

bb.t...@gmx.com changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

--


[Issue 13949] Alias baseName() as stripPath()

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13949

bb.t...@gmx.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WONTFIX

--


[Issue 14186] Silent syntax change from C and C++

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14186

--- Comment #2 from Sobirari Muhomori dfj1es...@sneakemail.com ---
Interesting, C99 and C11 don't allow for that:

assignment-expression:
  conditional-expression
  unary-expression assignment-operator assignment-expression

i.e. same precedence right-to-left associative.

--


[Issue 14186] Silent syntax change from C and C++

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14186

--- Comment #3 from Sobirari Muhomori dfj1es...@sneakemail.com ---
Can you confirm it with --std=c99 -pedantic?

--


[Issue 14186] Silent syntax change from C and C++

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14186

--- Comment #4 from ag0ae...@gmail.com ---
(In reply to Sobirari Muhomori from comment #3)
 Can you confirm it with --std=c99 -pedantic?

Same error:


$ gcc --std=c99 -pedantic test.c
test.c: In function ‘main’:
test.c:5:15: error: lvalue required as left operand of assignment
 1 ? b : c = 0;
   ^
$ gcc --version
gcc (Ubuntu 4.9.1-16ubuntu6) 4.9.1


--


[Issue 14186] Silent syntax change from C and C++

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14186

--- Comment #5 from Sobirari Muhomori dfj1es...@sneakemail.com ---
Looks like gcc has some history under this issue:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=6905

--


[Issue 9685] Context pointer of struct isn't copied when a closure is passed by alias

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9685

ag0ae...@gmail.com changed:

   What|Removed |Added

   Keywords||wrong-code
 CC||ag0ae...@gmail.com

--


[Issue 7267] nothrow functions with lazy arguments too

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7267

Mathias LANG pro.mathias.l...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||pro.mathias.l...@gmail.com
 Resolution|--- |DUPLICATE

--- Comment #1 from Mathias LANG pro.mathias.l...@gmail.com ---
#12647 is a duplicate of this, but has more comments and a P.R. for it, so I'm
marking this one as duplicate.

*** This issue has been marked as a duplicate of issue 12 ***

--


[Issue 12] Assertion in pthread

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12

Mathias LANG pro.mathias.l...@gmail.com changed:

   What|Removed |Added

 CC||bearophile_h...@eml.cc

--- Comment #2 from Mathias LANG pro.mathias.l...@gmail.com ---
*** Issue 7267 has been marked as a duplicate of this issue. ***

--


[Issue 12647] Lazy parameter evaluation should be marked as nothrow

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12647

--- Comment #4 from Mathias LANG pro.mathias.l...@gmail.com ---
*** Issue 7267 has been marked as a duplicate of this issue. ***

--


[Issue 7267] nothrow functions with lazy arguments too

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=7267

--- Comment #2 from Mathias LANG pro.mathias.l...@gmail.com ---


*** This issue has been marked as a duplicate of issue 12647 ***

--


[Issue 9685] Context pointer of struct isn't copied when a closure is passed by alias

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9685

John Colvin john.loughran.col...@gmail.com changed:

   What|Removed |Added

 CC||john.loughran.colvin@gmail.
   ||com

--- Comment #1 from John Colvin john.loughran.col...@gmail.com ---
Apparently this is a the same bug, see
http://forum.dlang.org/post/crhogpikareipbtys...@forum.dlang.org

import std.stdio;
struct MapResult(alias fun)
{
@property int front() {return fun();}
@property auto save() {return typeof(this)();}
}
void main()
{
int ys_length = 4;
auto dg = {return MapResult!({return ys_length;})();};
writeln(dg().front); /* 4, correct */
writeln(dg().save.front); /* garbage */
}

--


[Issue 9685] Context pointer of struct isn't copied when a closure is passed by alias

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9685

--- Comment #2 from John Colvin john.loughran.col...@gmail.com ---
This doesn't happen with ldc 0.15.1

Observed in dmd git HEAD, 2.066.1 and 2.065.0

--


[Issue 12500] ICE in codegen when multiplying an incremented size_t by a double

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12500

Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Keywords||pull

--- Comment #3 from Kenji Hara k.hara...@gmail.com ---
https://github.com/D-Programming-Language/dmd/pull/4415

--


[Issue 14102] Bad 'is not an lvalue' diagnostic in chained -unary and --preincr expressions.

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14102

Kenji Hara k.hara...@gmail.com changed:

   What|Removed |Added

   Hardware|x86_64  |All
 OS|Linux   |All

--- Comment #2 from Kenji Hara k.hara...@gmail.com ---
PR https://github.com/D-Programming-Language/dmd/pull/4415 will improve the
diagnostic to:

test.d(3): Error: -x is not an lvalue
test.d(4): Error: -(x -= 1) is not an lvalue
test.d(5): Error: -(x -= 1 -= 1) is not an lvalue
test.d(6): Error: -(x -= 1 -= 1 -= 1) is not an lvalue

It's not perfect, but far better.

--


[Issue 14068] [AA] Concurrent access allowed

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14068

Sobirari Muhomori dfj1es...@sneakemail.com changed:

   What|Removed |Added

   Keywords||safe

--


[Issue 14186] New: Silent syntax change from C and C++

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14186

  Issue ID: 14186
   Summary: Silent syntax change from C and C++
   Product: D
   Version: D1  D2
  Hardware: All
OS: All
Status: NEW
  Keywords: spec
  Severity: normal
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: dfj1es...@sneakemail.com

(a ? b : c = 0) is parsed as ((a ? b : c) = 0) in D,
but as (a ? b : (c = 0)) in C and C++.

--


[Issue 14187] New: Wrong overload resolution when one of the parameters to a function is an interface

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14187

  Issue ID: 14187
   Summary: Wrong overload resolution when one of the parameters
to a function is an interface
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: DMD
  Assignee: nob...@puremagic.com
  Reporter: monkeywork...@hotmail.com

This problem appears only if one of the parameters is an 
interface. Without it or using any other type as a second 
parameter instead of the interface, it compiles. Also it compiles 
if the passed interface is null. The example below uses 
short/ushort, but there is the same behaviour for any combination 
of integral types of the same bitsize (byte/ubyte/char, 
ushort/short/wchar, int/uint/dchar, long/ulong)

D 2.066.1

interface I {}
class C: I {}

void func(ushort s, I i)
{
writeln(ushort overload);
}

void func(short s, I i)
{
writeln(short overload);
}

void call(short s)
{
C c = new C();
I d = new C();
func(s, c); //  ERROR  see below

//but these are ok

func(s, cast(I)c) //ok
func(s, d) //ok
func(s, null) //ok

}

main.func called with argument types (short, C) matches both:
main.func(short s, I i)
main.func(ushort s, I i)

--


[Issue 14139] GIT HEAD : PI now has wrong value

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14139

Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution|--- |WONTFIX

--- Comment #7 from Walter Bright bugzi...@digitalmars.com ---
(In reply to Temtaime from comment #4)
 I'm using MSVC 2013 with /O2 /GL /Gw /fp:fast.
 
 Can /fp:fast have an effect on DMD ? I'll with /GL and without /fp:fast,
 okay.

According to Microsoft documentation, /fp:fast will:

Creates the fastest code in most cases by relaxing the rules for optimizing
floating-point operations. This enables the compiler to optimize floating-point
code for speed at the expense of accuracy and correctness.

 -- https://msdn.microsoft.com/en-us/library/e7s85ffb.aspx

I interpret that as meaning insert random bugs in floating point code.

DMD is not designed to work with that, and was certainly never tested with
that. I'm going to mark this as WONTFIX. The only supported build options are
the ones in the VS solution included with DMD.

--


[Issue 14134] Free of large array does not work

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14134

Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution|--- |FIXED

--- Comment #14 from Walter Bright bugzi...@digitalmars.com ---
When writing pull requests that fix a bugzilla issue, write the title as:

Fix Issue  

so that the bugzilla issue ill be automatically marked as fixed when it gets
pulled.

--


[Issue 14186] Silent syntax change from C and C++

2015-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14186

ag0ae...@gmail.com changed:

   What|Removed |Added

 CC||ag0ae...@gmail.com

--- Comment #1 from ag0ae...@gmail.com ---
I'm not well-versed in C/C++, but according to these pages:

http://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html#Operator-Precedence
(points 13 and 14)
http://en.cppreference.com/w/cpp/language/operator_precedence#content (point
15)

it's C++ that deviated from C. Whereas D is line with C.

A little test with gcc and g++ seems to confirm that:


#include stdio.h
int main()
{
int b = 1, c = 1;
1 ? b : c = 0;
printf(%d\n, b);
return 0;
}


Compiling with gcc gives

test.c: In function ‘main’:
test.c:5:15: error: lvalue required as left operand of assignment
 1 ? b : c = 0;
   ^


Compiling with g++ succeeds, and running prints 1.

--