[Issue 17162] New: std.algorithm.startsWith fails to compile with -dip1000 switch

2017-02-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17162

  Issue ID: 17162
   Summary: std.algorithm.startsWith fails to compile with
-dip1000 switch
   Product: D
   Version: D2
  Hardware: x86_64
OS: Windows
Status: NEW
  Severity: regression
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: monkeywork...@hotmail.com

import std.algorithm;

mixin template Property(alias member)
if (member.stringof.startsWith('_'))
{
import std.format: format;
import std.range: dropOne;

enum mixStrGet = `
@property typeof(member) %s()
{
return member;
}
`.format(member.stringof.dropOne());

mixin(mixStrGet);
}

struct Test
{
int _n;

mixin Property!_n;
}


Compiler switches:

-dip1000 -main


Error message:

dip100bug.d(4): Error: template std.algorithm.searching.startsWith cannot
deduce function from argument types !()(string, char), candidates are:
C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\searching.d(3944):   
std.algorithm.searching.startsWith(alias pred = "a == b", Range,
Needles...)(Range doesThisStart, Needles withOneOfThese) if (isInputRange!Range
&& Needles.length > 1 && is(typeof(.startsWith!pred(doesThisStart,
withOneOfThese[0])) : bool) && is(typeof(.startsWith!pred(doesThisStart,
withOneOfThese[1..__dollar])) : uint))
C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\searching.d(4017):   
std.algorithm.searching.startsWith(alias pred = "a == b", R1, R2)(R1
doesThisStart, R2 withThis) if (isInputRange!R1 && isInputRange!R2 &&
is(typeof(binaryFun!pred(doesThisStart.front, withThis.front)) : bool))
C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\searching.d(4086):   
std.algorithm.searching.startsWith(alias pred = "a == b", R, E)(R
doesThisStart, E withThis) if (isInputRange!R &&
is(typeof(binaryFun!pred(doesThisStart.front, withThis)) : bool))
C:\D\dmd2\windows\bin\..\..\src\phobos\std\algorithm\searching.d(4096):   
std.algorithm.searching.startsWith(alias pred, R)(R doesThisStart) if
(isInputRange!R && ifTestable!(typeof(doesThisStart.front), unaryFun!pred))
dip100bug.d(23):while looking for match for Property!(_n)

--


[Issue 17161] New: [REG 2.072.2] Massive Regex Slowdown

2017-02-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17161

  Issue ID: 17161
   Summary: [REG 2.072.2] Massive Regex Slowdown
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: regression
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: j...@jackstouffer.com

Created attachment 1636
  --> https://issues.dlang.org/attachment.cgi?id=1636=edit
The sample code

8x slower.

Not noticeable on smaller files. The input file to reproduce is too large to
post here. You can generate it by running the python code here:
https://benchmarksgame.alioth.debian.org/u64q/program.php?test=fasta=python3=3

$ python3 fasta.py 500 > input500.txt

# 2.072.2
$ /Users/Jack/digger/result/bin/dmd -O -inline -release -boundscheck=off slow.d
$ cat input500.txt | time ./slow
./slow  2.19s user 0.09s system 97% cpu 2.330 total


# 2.073.0
$ dmd -O -inline -release -boundscheck=off slow.d
$ cat input500.txt | time ./slow
./slow  18.23s user 0.16s system 98% cpu 18.616 total

--


[Issue 17160] Apparently faulty behavior comparing enum members using `is`

2017-02-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17160

j...@red.email.ne.jp changed:

   What|Removed |Added

   Keywords||wrong-code
 CC||j...@red.email.ne.jp

--- Comment #2 from j...@red.email.ne.jp ---
This seems to work without the parameter attr 'in'.

test(Enum a)

--


[Issue 17160] Apparently faulty behavior comparing enum members using `is`

2017-02-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17160

--- Comment #1 from Sophie  ---
This issue seems not to occur when using `enum Enum: real` instead of double.

>From IRC:

 hmm it does a byte comparison but they differ, one is 00D0CC... the other
is CDCC...
 i am guessing that the enum treats it more like a literal than
the variable does so it gets imprecise passed to functions
 it stores the literial enum value as a real 80-bit floating point number
 but it looks like it passes a double into the function

--


[Issue 17160] New: Apparently faulty behavior comparing enum members using `is`

2017-02-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17160

  Issue ID: 17160
   Summary: Apparently faulty behavior comparing enum members
using `is`
   Product: D
   Version: D2
  Hardware: x86_64
OS: Windows
Status: NEW
  Severity: major
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: meapineap...@gmail.com

With DMD v2.072.2 on Windows 7 this code produces an assertion error:

unittest{
enum Enum: double{A = 0.1}
bool test(in Enum a){return a is Enum.A;}
assert(test(Enum.A));
}

When `A = 1` or other values that can be represented more exactly as a floating
point, the code does not produce an error.

Given that this code does not produce such an error, I'm especially inclined to
think this is not intended behavior:

unittest{
enum Enum: double{A = 0.1}
assert(Enum.A is Enum.A);
}

--


[Issue 16577] deduplicate deprecation messages

2017-02-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16577

Martin Nowak  changed:

   What|Removed |Added

 CC||c...@dawg.eu
   Severity|minor   |enhancement

--- Comment #2 from Martin Nowak  ---
Would be fairly simple to deduplicate deprecation messages when triggering
them, not sure about the memory requirements (prolly not much) or other
strategies to avoid emitting the same message.
We should only deduplicate messages occuring at the same source location, so
that it remains possible to fix all of them in one go.

--


[Issue 17159] Behavior of unions at compile time is not documented

2017-02-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17159

Sophie  changed:

   What|Removed |Added

 CC||meapineap...@gmail.com

--- Comment #1 from Sophie  ---
>From IRC:

 lost my login
 can someone answer this
http://forum.dlang.org/thread/mailman.319.1486565256.31550.digitalmars-d-b...@puremagic.com
and say that this has been the case for ages
 and that newCTFE will eventually fix it if it is _really_ desired
I'd say it catches bugs

--


[Issue 17159] New: Behavior of unions at compile time is not documented

2017-02-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17159

  Issue ID: 17159
   Summary: Behavior of unions at compile time is not documented
   Product: D
   Version: D2
  Hardware: All
   URL: https://dlang.org/spec/function.html#interpretation
OS: All
Status: NEW
  Keywords: CTFE, spec
  Severity: normal
  Priority: P1
 Component: dlang.org
  Assignee: nob...@puremagic.com
  Reporter: dfj1es...@sneakemail.com

E.g. access to overlapped fields is not allowed.

--


[Issue 17158] New: [404 Not Found]

2017-02-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17158

  Issue ID: 17158
   Summary: [404 Not Found]
   Product: D
   Version: D2
  Hardware: All
   URL: http://dlang.org/
OS: All
Status: NEW
  Severity: normal
  Priority: P3
 Component: dlang.org
  Assignee: nob...@puremagic.com
  Reporter: basti...@veelo.net

The std.concurrencybase link in the side bar of
https://dlang.org/phobos/index.html yields a 404.

--


[Issue 17157] New: ctRegex.matchAll doesn't set last item in Captures

2017-02-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17157

  Issue ID: 17157
   Summary: ctRegex.matchAll doesn't set last item in Captures
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: criman...@gmail.com

Reproduce code:
int main() 
{
import std.stdio;
import std.regex;

//auto r = ctRegex!"(a)|(b)|(c)|(d)"; /* // <- uncomment to switch to
ctRegex
auto r = regex("(a)|(b)|(c)|(d)"); //*/
auto s = "--a--b--c--d--";

foreach(match; s.matchAll(r))
{
foreach(i; 0..match.length)
write(i,":",match[i]," ");
writeln();
}

return 0;
}

if line 6 commented and regex() is used then output is correct:
0:a 1:a 2: 3: 4: 
0:b 1: 2:b 3: 4: 
0:c 1: 2: 3:c 4: 
0:d 1: 2: 3: 4:d 

if comment at line 6 beginning is removed and ctRegex is used then we have
exception:

core.exception.AssertError@/usr/include/dmd/phobos/std/regex/package.d(565):
wrong match: 1..0

??:? _d_assert_msg [0x4edba6]
??:? std.regex.Captures!(immutable(char)[],
ulong).Captures.opIndex!().opIndexinout(pure nothrow @trusted
inout(immutable(char)[]) function(ulong)) [0x4e4f01]
??:? _Dmain [0x4bb73e]
??:? _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv [0x4ef333]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).tryExec(scope void delegate()) [0x4ef25b]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).runAll() [0x4ef2d8]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int
function(char[][])*).tryExec(scope void delegate()) [0x4ef25b]
??:? _d_run_main [0x4ef1c7]
??:? main [0x4eae0f]
??:? __libc_start_main [0xc012282f]

More experiments have shown: last element of match is not set and attempt to
access it leads to exception. 

Compiler: DMD64 D Compiler v2.073.0
OS: Ubuntu 16.04 LTS

--


[Issue 17156] New: Local function declaration not inferred to be static

2017-02-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17156

  Issue ID: 17156
   Summary: Local function declaration not inferred to be static
   Product: D
   Version: D2
  Hardware: All
   URL: http://dlang.org/
OS: All
Status: NEW
  Severity: normal
  Priority: P3
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: e...@weka.io

void f() {
uint function() a = () => 5; // OK

static uint s() { return 5; }
uint function() b =  // ALSO OK

uint g() { return 5; }
uint function() c =  // BOOM! "" is a delegate. why?
}


There should not really be a difference between "s" and "g". The "static" there
should be inferred from lack of any lexical capture.

--


[Issue 16434] dmd assertion failure in declaration.d

2017-02-08 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16434

Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |WORKSFORME

--- Comment #5 from Walter Bright  ---
Can't reproduce it. Please reopen if it can be reproduced in HEAD.

--