[Issue 18711] New: Suggest to slice a static array when the called function would accept it

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18711

  Issue ID: 18711
   Summary: Suggest to slice a static array when the called
function would accept it
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: diagnostic
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: greensunn...@gmail.com

>From the NG
(https://forum.dlang.org/post/migoytwwjmzuzmxsu...@forum.dlang.org).
The following correctly errors:

wchar[10] buffer;
toUTF8(buffer);

However, the error message is a bit cryptic for newcomers:

Error: template `std.utf.toUTF8` cannot deduce function from argument types
`!()(wchar[10])`, candidates are:
/dlang/dmd/linux/bin64/../../src/phobos/std/utf.d(2713):   
`std.utf.toUTF8(S)(S s) if (isInputRange!S && !isInfinite!S &&
isSomeChar!(ElementEncodingType!S))`


DMD could detect that toUTF8 would accept `buffer[]` and could suggest this to
the user.

--


[Issue 18710] executable file not generated when -o- is used

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18710

Seb  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com

--- Comment #1 from Seb  ---
AFAIK `-o-` became the "undocumented" way to turn DMD's entire backend off.

> I think `dmd -o- main.d` should generate the `main` executable, but not the 
> `main.o` object file.

Hmm, how would you turn off object generation then?
Note that dmd -ofmain main.d won't generate an object file, but only the main
executable.

--


[Issue 12511] static overloaded function is not accessible

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12511

Domain  changed:

   What|Removed |Added

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

--- Comment #4 from Domain  ---
Still has problem:

class A
{
private static void foo(int i, int j)
{

}

public static void foo(int i)
{
A.foo(i, 0);
}
}

Error: function test.A.foo(int i) is not callable using argument types (int,
int)

But change A.foo(1, 0) to foo(i, 0) passed.

--


[Issue 17626] Same name variable assignment should raise a compile-time warning

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17626

Seb  changed:

   What|Removed |Added

   Keywords||pull
 CC||greensunn...@gmail.com

--- Comment #4 from Seb  ---
I agree that this is a very common error. Let's try to get it in DMD first:

https://github.com/dlang/dmd/pull/8119

--


[Issue 12116] dmd -op -od broken

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12116

Mike Franklin  changed:

   What|Removed |Added

   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=18710

--


[Issue 18710] executable file not generated when -o- is used

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18710

Mike Franklin  changed:

   What|Removed |Added

   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=12116

--


[Issue 18710] New: executable file not generated when -o- is used

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18710

  Issue ID: 18710
   Summary: executable file not generated when -o- is used
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: slavo5...@yahoo.com

Consider:

---main.d
import std.stdio;

void main()
{
writeln("Hello, World!");
}

`dmd main.d` generates a `main.o` object file and a `main` executable.

`dmd -o- main.d` generates nothing

I think `dmd -o- main.d` should generate the `main` executable, but not the
`main.o` object file.

--


[Issue 18708] Flow analysis in constructors not done correctly for if, ||, &

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18708

--- Comment #1 from Walter Bright  ---
https://github.com/dlang/dmd/pull/8118

--


[Issue 18709] DDOC_AUTO_PSYMBOL and friends are wrong

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18709

--- Comment #1 from github-bugzi...@puremagic.com ---
Commit pushed to master at https://github.com/dlang/dlang.org

https://github.com/dlang/dlang.org/commit/18406fccda4e129059b75b188a4b99d05b2be7ab
fix DDOC_AUTO_{PSYMBOL,KEYWORD,PARAM}

Fixes issue 18709.

--


[Issue 18709] DDOC_AUTO_PSYMBOL and friends are wrong

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18709

github-bugzi...@puremagic.com changed:

   What|Removed |Added

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

--


[Issue 18672] Error in @safe transitive propagation with associative arrays

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18672

--- Comment #4 from Seb  ---
@RazvanN how about setting the opAssign to @trusted instead when we now that
the dtor is @safe?
The problem is that sd.dtor.isSafe() returns 0 :/
Maybe we need to go through semantic first before looking at this?
Also there seems to be an existing check for this already - it just doesn't get
triggered

```
stc = mergeFuncAttrs(stc, sd.dtor);
if (stc & STC.safe)
```

Well at least the high-level isSafe traits infers the safety correctly:

https://run.dlang.io/is/6ePqDY

--


[Issue 18709] New: DDOC_AUTO_PSYMBOL and friends are wrong

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18709

  Issue ID: 18709
   Summary: DDOC_AUTO_PSYMBOL and friends are wrong
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Keywords: pull
  Severity: normal
  Priority: P1
 Component: dlang.org
  Assignee: nob...@puremagic.com
  Reporter: ag0ae...@gmail.com

https://forum.dlang.org/post/p9u7p1$2sj7$1...@digitalmars.com

The definitions of DDOC_AUTO_PSYMBOL, DDOC_AUTO_KEYWORD, and DDOC_AUTO_PARAM
are wrong.

https://github.com/dlang/dlang.org/pull/2326

--


[Issue 9665] Structure constant members can not be initialized if have opAssign

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=9665

Walter Bright  changed:

   What|Removed |Added

   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=18708

--


[Issue 18708] Flow analysis in constructors not done correctly for if, ||, &

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18708

Walter Bright  changed:

   What|Removed |Added

   Keywords||accepts-invalid,
   ||rejects-valid

--


[Issue 18708] Flow analysis in constructors not done correctly for if, ||, &

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18708

Walter Bright  changed:

   What|Removed |Added

   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=9665

--


[Issue 18705] dmd segmentation fault with duplicate class definition

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18705

ag0aep6g  changed:

   What|Removed |Added

   Keywords||ice
 CC||ag0ae...@gmail.com

--


[Issue 18708] New: Flow analysis in constructors not done correctly for if, ||, &

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18708

  Issue ID: 18708
   Summary: Flow analysis in constructors not done correctly for
if, ||, &&
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: bugzi...@digitalmars.com

struct S { int y; @disable this(); }  // so construction is required

  class C
  {
S s;

this(S t)
{
if (bar(s = t)) foo(); // bug: Error: one path skips field s
}

this(S t, int i)
{
i || bar(s = t);  // bug: should give error
}

this(S t, int i, int j)
{
i && bar(s = t);  // bug: should give error
}

this(S t, int i, long j)
{
i ? bar(s = t) : i;   // good: Error: one path skips field s
}

this(S t, int i, long j)
{
i ? i : bar(s = t);   // good: Error: one path skips field s
}
  }

  int bar(S s);
  int foo();

--


[Issue 18474] Postblit not working in shared structs

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18474

--- Comment #4 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/3a0f75d959bd8e875a7d7767caed8ae3fa94ee8e
Fix Issue 18474 - Postblit not working in shared structs

https://github.com/dlang/dmd/commit/e1aaf4ce8e9df63e383b60b2891051d633a63d76
Merge pull request #8098 from RazvanN7/Issue_18474

Fix Issue 18474 - Postblit not working in shared structs
merged-on-behalf-of: Andrei Alexandrescu 

--


[Issue 18026] Stack overflow in ddmd/dtemplate.d:6241, TemplateInstance::needsCodegen()

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18026

Seb  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com

--- Comment #2 from Seb  ---
> When I reduce the problem with dustmite I end up with nonsense that 
> apparently does still trigger the behaviour, but isn't something you can 
> reason about. Things like function calls that *need to be there* for 
> everything to work, and without which I get the overflow.

Could you still post the reduced example?

> Is there anything I can do to help diagnose?

Well, the smaller the reduced example, the easier it will be to dive through
the DMD codebase and fix the issue.
Apart from that maybe also post the issue on the #dbugfix campaign, s.t. it
gets more exposure:

https://dlang.org/blog/2018/02/03/the-dbugfix-campaign/

--


[Issue 18707] New: Destructor of qualified objects not typechecked properly

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18707

  Issue ID: 18707
   Summary: Destructor of qualified objects not typechecked
properly
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: and...@erdani.com

Consider:


int[] sneaky;
struct A
{
private int[] innocent;
~this()
{
sneaky = innocent;
}
}
void main()
{
immutable a = A([1, 2, 3]);
{
  auto b = a;
}
sneaky[1] = 42; // oops
import std.stdio;
writeln(a.innocent); // ops
}

The destructor should not unqualify the structure, or should in limited ways.

--


[Issue 18706] New: Documentation on default class member initializers could be improved

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18706

  Issue ID: 18706
   Summary: Documentation on default class member initializers
could be improved
   Product: D
   Version: D2
  Hardware: Other
OS: Other
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dlang.org
  Assignee: nob...@puremagic.com
  Reporter: laurent.treguier.s...@gmail.com

According to the docs (https://dlang.org/spec/class.html#constructors), class
members can be initialized with code like this:


class MyClass {
int integer = 42;
Object objectMember = new Object();
}


At first glance, this seems pretty straightforward, as such syntax can be used
in other languages such as Java. However, when the member's type is a class and
not a basic type or a struct, things behave differently in D.
A single object will be created and used to initialize `objectMember` in every
`MyClass` instance. Every new `MyClass` object will not have its own `Object`
instance in `objectMember`, but instead all of them will hold a reference to
the same object. Example : https://run.dlang.io/is/Qlx2xY

This behavior can come as unexpected when coming from another language, and
expliciting it in the docs might be helpful for newcomers.

--


[Issue 18026] Stack overflow in ddmd/dtemplate.d:6241, TemplateInstance::needsCodegen()

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18026

--- Comment #1 from JR  ---
I am now at a stage where with 2.079.0 I can no longer trick dmd on linux into
compiling my project in release mode (or dub -b plain) at all; only debug
works. dmd 2.079.0 fails with exit code -11, with gdb backtraces listing
needsCodegen(). I can still coerce dmd 2.078.3 and ldc 1.8.0 into compiling,
partly. I expect ldc will similarly stop working when a new version of it based
on 2.079 is released.

When I reduce the problem with dustmite I end up with nonsense that apparently
does still trigger the behaviour, but isn't something you can reason about.
Things like function calls that *need to be there* for everything to work, and
without which I get the overflow.

The commit that didn't work in the previously linked overflow branch now builds
in 2.079.0, but instead now all my other tricks don't for the current state of
the codebase. The issue is an emergent property of a hundred little things.

Is there anything I can do to help diagnose?

> $ git clone https://github.com/zorael/kameloso
> $ cd kameloso
> $ git checkout 8b05c0f  # unreduced until interest expressed, expect build 
> times
> $ dub build -c vanilla -b plain
> /usr/bin/dmd failed with exit code -11.

--


[Issue 13727] std.stdio.File not thread-safe

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=13727

Seb  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com

--- Comment #16 from Seb  ---
There's currently a Phobos PR by Jack that might fix this:

https://github.com/dlang/dmd/pull/5747

--


[Issue 14997] __ctor present in error message

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14997

github-bugzi...@puremagic.com changed:

   What|Removed |Added

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

--


[Issue 14997] __ctor present in error message

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14997

--- Comment #2 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/c2944b50419ae4e3fb7b2d8868c77e42e698c155
Fix Issue 14997 -  __ctor present in error message

https://github.com/dlang/dmd/commit/80157ad7a339a6fbf94a43bfb8fbab8afe3265da
Merge pull request #8115 from RazvanN7/Issue_14997

[Trivial]Fix Issue 14997 -  __ctor present in error message

--


[Issue 18052] LockingTextWriter is not thread safe

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18052

Jack Stouffer  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||j...@jackstouffer.com
 Resolution|--- |INVALID

--- Comment #2 from Jack Stouffer  ---
According to
https://digitalmars.com/d/archives/digitalmars/D/Invoking_writeln_from_a_lot_of_threads_running_concurrently_--_309051.html#N309071
in that thread, this is an invalid bug.

--


[Issue 18504] Assert in synchronized crashes with SIGILL on exit

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18504

--- Comment #3 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/c0592d257413abee0d20ff8b1ce660c5774244cb
Fix issue 18504 - Generate unwind tables for halting functions

https://github.com/dlang/dmd/commit/0038ec300710db7939f45f538d03c6528f83ba7a
Merge pull request #8027 from LemonBoy/b18504

Fix issue 18504 - Generate unwind tables for halting functions
merged-on-behalf-of: Razvan Nitu 

--


[Issue 18504] Assert in synchronized crashes with SIGILL on exit

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18504

github-bugzi...@puremagic.com changed:

   What|Removed |Added

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

--


[Issue 18702] FAQ item "What does D have that C++ doesn't?" comparison link (https://dlang.org/articles/comparison.html) returns 404

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18702

github-bugzi...@puremagic.com changed:

   What|Removed |Added

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

--


[Issue 18702] FAQ item "What does D have that C++ doesn't?" comparison link (https://dlang.org/articles/comparison.html) returns 404

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18702

--- Comment #2 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/dlang/dlang.org

https://github.com/dlang/dlang.org/commit/598ba59597c4a6a0fcc48dc7c0033ff585226e59
Fix Issue 18702 - FAQ item 'What does D have that C++ doesn't?' comparison link

https://github.com/dlang/dlang.org/commit/4201c3624ad91e4ee5710b1007fe69e0547daa1f
Merge pull request #2323 from wilzbach/fix-18702

Fix Issue 18702 - FAQ item 'What does D have that C++ doesn't?' comparison link
merged-on-behalf-of: Mike Franklin 

--


[Issue 14997] __ctor present in error message

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14997

RazvanN  changed:

   What|Removed |Added

 CC||razvan.nitu1...@gmail.com

--- Comment #1 from RazvanN  ---
PR : https://github.com/dlang/dmd/pull/8115

--


[Issue 18705] New: dmd segmentation fault with duplicate class definition

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18705

  Issue ID: 18705
   Summary: dmd segmentation fault with duplicate class definition
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: te...@wannabephoenix.de

dlang forum:
https://forum.dlang.org/post/qlmvefrlyykojtcze...@forum.dlang.org

snippet
https://run.dlang.io/is/OySBGO

the provoking line is commented out in that snippet. when commented in, all
compilers give the segfault, including ldc ones. except for 'all dmd
compilers..' with version <= 2.066.0

post by LiNbO3 might give more details
> 
> There are a couple of bugs here:
> 
> ---
> void main()
> {
> { class C { } }
> class C { }
> // C x; x.x=1;
> // static assert (!__traits(compiles, C.x));
> }
> ---
> 
> The first bug can be shown by de-commenting the first line and can be easily 
> solved by modifying hdrgen.d by adding a check on t.sym.parent being non-null 
> to the visit(TypeClass) method.
> Once that's fixed de-comment the second line to have the compiler crash and 
> burn somewhere else.

--


[Issue 18704] std/datetime/stopwatch.d(452) assertion failure on auto-tester

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18704

--- Comment #1 from Seb  ---
https://github.com/dlang/phobos/pull/6404

--


[Issue 18704] New: std/datetime/stopwatch.d(452) assertion failure on auto-tester

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18704

  Issue ID: 18704
   Summary: std/datetime/stopwatch.d(452) assertion failure on
auto-tester
   Product: D
   Version: D2
  Hardware: x86
OS: FreeBSD
Status: NEW
  Severity: normal
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: greensunn...@gmail.com

I see the following failure on auto-tester:

---
** FAIL debug32 std.datetime.stopwatch
core.exception.AssertError@std/datetime/stopwatch.d(452): unittest failure

gmake[1]: *** [posix.mak:380: unittest/std/datetime/stopwatch.run] Error 1
gmake[1]: *** Waiting for unfinished jobs
---

https://auto-tester.puremagic.com/show-run.ghtml?projectid=1=3102407=true


```
void f0() nothrow {}
void f1() nothrow { auto b = to!string(a); }
auto r = benchmark!(f0, f1)(1000);
assert(r[0] >= Duration.zero);
assert(r[1] > Duration.zero);
assert(r[1] > r[0]);
```

It looks like we need to disable optimization of f1.

--


[Issue 12663] Wrong error message for mutation of immutable static array

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12663

Seb  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com

--- Comment #1 from Seb  ---
PR https://github.com/dlang/dmd/pull/8009

--


[Issue 14397] dmd: Provide full source range for compiler errors [enhancement]

2018-04-02 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14397

Seb  changed:

   What|Removed |Added

 CC||greensunn...@gmail.com
   Hardware|x86_64  |All
 OS|Windows |All

--