[Issue 21872] New: Warning: statement is not reachable should be error instead of warning!

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21872

  Issue ID: 21872
   Summary: Warning: statement is not reachable should be error
instead of warning!
   Product: D
   Version: D2
  Hardware: x86
OS: Mac OS X
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: min...@gmail.com

Currently the compiler will *stop* after issue this warning:

```
Warning: statement is not reachable
```


This should be made as error, instead of warning.

warning: compiler continue to work.
error:   compiler stop.

--


[Issue 21871] New: Accessing elements of "static immutable" arrays passed as template parameters requires allocation

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21871

  Issue ID: 21871
   Summary: Accessing elements of "static immutable" arrays passed
as template parameters requires allocation
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: diagnostic, rejects-valid
  Severity: normal
  Priority: P3
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: dlang-bugzi...@thecybershadow.net

 test.d ///
struct S
{
int[] arr;
}

void fun(S s)() @nogc
{
if (s.arr[0]) {}
}

static immutable S s1 = S([1]);

alias fun1 = fun!s1;
///

Compiler output:

test.d(11,27): Error: array literal in `@nogc` function `test.fun!(S([1])).fun`
may cause a GC allocation
test.d(13,14): Error: template instance `test.fun!(S([1]))` error instantiating

There are potentially three issues here:

1. The `s` parameter already has storage allocated for it, so, accessing an
element of it should not require an allocation. It looks like currently when
passing a static immutable argument to a value template parameter, the value is
used like an `enum`.

2. Accessing an element of an `enum` array really shouldn't require allocating
the array first.

3. The error message occurs far from the point where the allocation is
attempted. Even though the error message mentions `fun`, none of the locations
are within `fun`.

--


[Issue 21870] New: Property/method not invoked and requires () when used in static array length

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21870

  Issue ID: 21870
   Summary: Property/method not invoked and requires () when used
in static array length
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Keywords: diagnostic, rejects-valid
  Severity: normal
  Priority: P3
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: dlang-bugzi...@thecybershadow.net

// test.d /
struct S
{
@property size_t count() const
{
return 1;
}
}

int[S.init.count()] x; // OK
int[S.init.count  ] y; // error
// Error: need `this` for `count` of type `const @property ulong()`
///

Additionally, the error message is misleading. Older versions of compilers
produced a better error:

2.079.0 to 2.087.1: Failure with output: test.d(9): Error: integer constant
expression expected instead of `S().count`

--


[Issue 16783] std.net.curl application throws an exception

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16783

Berni44  changed:

   What|Removed |Added

 CC||bugzi...@bernis-buecher.de

--- Comment #7 from Berni44  ---
Some analysis: Function pty

https://github.com/dlang/phobos/blob/master/std/concurrency.d#L2239

receives a VariantN containing a

"std.net.curl.CurlException@/home/D/Repo/dmd/generated/linux/release/64/../../../../../phobos/std/net/curl.d(5279):
Couldn't resolve host name on handle 5654F7BC4F50"

but cannot convert this to Throwable and hence throws a
PriorityMessageException.


I think that the "convertsTo" check doesn't work correctly and thus does not
throw this exception as expected. (I know too little about std.variant to
continue here.)


Further, I think, the PriorityMessageException could be improved to tell more
details about its parameter "vals" in its message. Maybe

super("Priority message: " ~ vals.stringof);

would be better.

--


[Issue 19783] Fail to emplace struct with betterC

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=19783

Dlang Bot  changed:

   What|Removed |Added

   Keywords||pull

--- Comment #3 from Dlang Bot  ---
@MoonlightSentinel created dlang/druntime pull request #3454 "Fix 19783 - Fail
to emplace struct with betterC" fixing this issue:

- Fix 19783 - Fail to emplace struct with betterC

  Defining the helper function as a template ensures that it is available
  when not linking druntime.

  (`pragma(inline, true)` didn't work)

https://github.com/dlang/druntime/pull/3454

--


[Issue 20756] ImplicitConversionTargets ignores interface inheritance

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20756

--- Comment #6 from FeepingCreature  ---
ImplicitConversionTargets has been deprecated. AllImplicitConversionTargets
supports interface inheritance.

--


[Issue 21856] Implicit @safe violation of immutable

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21856

--- Comment #2 from RazvanN  ---
There seems to be a confusion in the compiler with regards to implicit
conversions and unique objects. If a pure functions creates a mutable object
and then it returns it, then the object is implicitly convertible to immutable
because nobody else could possibly modify.

That is why:

immutable(D) f(DA right) pure {
D ret = right;
return ret;
}

will compile. The compiler will consider that the function is pure, therefore
immutability cannot be broken. I think that this is a bug, since the conversion
should work only if the function is strongly pure, not any kind of purity.

But there is also the case of:

immutable(D) f(DA) pure {
D ret = new D();
return ret;
}

In the above case, it is fine to convert ret to immutable since nobody can
actually modify it.

The safest and most restrictive solution would be to simply allow the
conversion only if the function is strongly pure, thus dissalowing the latter
case, however, this may break code out there.

--


[Issue 21869] New: Invalid hyperlink to doxygen

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21869

  Issue ID: 21869
   Summary: Invalid hyperlink to doxygen
   Product: D
   Version: D2
  Hardware: x86
OS: Windows
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dlang.org
  Assignee: nob...@puremagic.com
  Reporter: paultjeadriaa...@gmail.com

The doxygen hyperlink at https://dlang.org/spec/ddoc.html is invalid as it
yields 404.

--


[Issue 20756] ImplicitConversionTargets ignores interface inheritance

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20756

Dlang Bot  changed:

   What|Removed |Added

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

--- Comment #5 from Dlang Bot  ---
dlang/phobos pull request #8016 "Fix issue 20756: Handle interface argument in
`AllImplicitConversionTargets`." was merged into master:

- 3e619db79c6e4e33c2cf39de213f3a097e3d9951 by Mathis Beer:
  Fix issue 20756: Handle interface argument in `AllImplicitConversionTargets`.

https://github.com/dlang/phobos/pull/8016

--


[Issue 21861] ctfe fails when a nested enum or function has a UDA

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21861

Dlang Bot  changed:

   What|Removed |Added

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

--- Comment #2 from Dlang Bot  ---
dlang/dmd pull request #12472 "Fix Issue 21861 - ctfe fails when a nested enum
or function has a UDA" was merged into master:

- 1d03b753733017828371b2527dc6cbea4be1304b by Boris Carvajal:
  Fix Issue 21861 - ctfe fails when a nested enum or function has a UDA

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

--


[Issue 21856] Implicit @safe violation of immutable

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21856

RazvanN  changed:

   What|Removed |Added

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

--- Comment #1 from RazvanN  ---
The error does not have anything to do with `@safe`. The fundamental issue is
that the implicit conversion is not signaled appropriately. If `f` is not
templated:

immutable(D) f(DA right) {
D ret = right;
return ret;
}

The compiler correctly errors: test.d(6): Error: cannot implicitly convert
expression `ret` of type `test.D` to `immutable(D)`

--


[Issue 21868] DIP1000 doesn't catch pointer to struct temporary

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21868

ag0aep6g  changed:

   What|Removed |Added

   Keywords||accepts-invalid, safe
 CC||ag0ae...@gmail.com

--


[Issue 21758] std.experimental.checkedint opBinaryRight with integer left-hand side does not compile for any operators except + and -

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21758

--- Comment #4 from Dlang Bot  ---
dlang/phobos pull request #8012 "merge stable" was merged into master:

- e516ec9351c9897417805a9f2b0839c9c099a97e by Nathan Sashihara:
  Fix Issue 21758 - std.experimental.checkedint opBinaryRight with integer
left-hand side does not compile for any operators except + and -

https://github.com/dlang/phobos/pull/8012

--


[Issue 21801] std.typecons.ReplaceType does not work for `in` parameters

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21801

--- Comment #3 from Dlang Bot  ---
dlang/phobos pull request #8012 "merge stable" was merged into master:

- b8cdef5ffcc3e9c9c65df27387247d53629cf2df by Johan Engelen:
  fix Issue 21801 - std.typecons.ReplaceType does not work for `in` parameters

  See related: https://github.com/dlang/phobos/pull/7570

https://github.com/dlang/phobos/pull/8012

--


[Issue 21721] casting std.BigInts to built-in floating point types doesn't work without -preview=dip1000

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21721

--- Comment #4 from Dlang Bot  ---
dlang/phobos pull request #8012 "merge stable" was merged into master:

- 40b34d3c1ff1d6bf8c75114c2c47d96c4864686f by Nathan Sashihara:
  Fix Issue 21721 - casting std.BigInts to built-in floating point types not
allowed in `@safe` code without -preview=dip1000

https://github.com/dlang/phobos/pull/8012

--


[Issue 21725] Specifying null as bitfields variable name now fails

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21725

--- Comment #4 from Dlang Bot  ---
dlang/phobos pull request #8012 "merge stable" was merged into master:

- b60108ed3f35f040e78ab9a8515565138b3e6da3 by Vladimir Panteleev:
  Fix Issue 21725 - Specifying null as bitfields variable name now fails

https://github.com/dlang/phobos/pull/8012

--


[Issue 21702] avoid quadratic template expansion in constraints of multiple search term versions of std.algorithm.searching.startsWith & endsWith

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21702

--- Comment #4 from Dlang Bot  ---
dlang/phobos pull request #8012 "merge stable" was merged into master:

- 6d9a508baf2689d7dcca54f677f8ec9ebdef421b by Nathan Sashihara:
  Fix issue #21702 - avoid quadratic template expansion in constraints of
multiple search term versions of std.algorithm.searching.startsWith & endsWith

https://github.com/dlang/phobos/pull/8012

--


[Issue 21724] std.algorithm.mutation.copy fails on overlapping arrays if the source array's pointer is less than the destination array's pointer

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21724

--- Comment #4 from Dlang Bot  ---
dlang/phobos pull request #8012 "merge stable" was merged into master:

- d32131d952ebe6f87b7e191f20788a1a9cd9b723 by Nathan Sashihara:
  Fix Issue 21724 - std.algorithm.mutation.copy fails on overlapping arrays if
the source array's pointer is less than the destination array's pointer

https://github.com/dlang/phobos/pull/8012

--


[Issue 21716] std.regex performance regression (additional GC allocation)

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21716

--- Comment #5 from Dlang Bot  ---
dlang/phobos pull request #8012 "merge stable" was merged into master:

- 97a78186ad2fdc24e37325863647eb1db04ad421 by Jon Degenhardt:
  Fix issue 21716: std.regex performance regression.

https://github.com/dlang/phobos/pull/8012

--


[Issue 21868] New: DIP1000 doesn't catch pointer to struct temporary

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21868

  Issue ID: 21868
   Summary: DIP1000 doesn't catch pointer to struct temporary
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: moonlightsenti...@disroot.org

Reduced example from TempCString in Phobos:

===
char* foo(string s) @safe
{
// Previously used via `alias this`
char* p = tempCString(s).ptr;

// Also works
TempCStringBuffer res;
p = res.ptr;

return p;
}

TempCStringBuffer tempCString(scope string str) @safe;

struct TempCStringBuffer
{
char* ptr() return scope @safe
{
return &_buff[0];
}

private:
char* _ptr; // <= Required
char[256] _buff;
}

===

Note that DMD reports the correct error when the unused `_ptr` is absent.

--


[Issue 20756] ImplicitConversionTargets ignores interface inheritance

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=20756

--- Comment #4 from Dlang Bot  ---
@FeepingCreature created dlang/phobos pull request #8016 "Fix issue 20756:
Handle interface argument in `AllImplicitConversionTargets`." fixing this
issue:

- Fix issue 20756: Handle interface argument in `AllImplicitConversionTargets`.

https://github.com/dlang/phobos/pull/8016

--


[Issue 21867] New: DMD fails to link after installing Visual Studio 2019

2021-04-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=21867

  Issue ID: 21867
   Summary: DMD fails to link after installing Visual Studio 2019
   Product: D
   Version: D2
  Hardware: x86_64
OS: Windows
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: z...@vec4.xyz

DMD fails to link after installing Visual Studio 2019 Community (installing
only .NET components).

To clarify, I used dmd without VS before and I had no issue.

To reproduce on my machine I just need to create empty folder c:\Program Files
(x86)\Microsoft Visual Studio\2019\Community\VC

lld-link: error: could not open 'libcmt.lib': no such file or directory
Error: linker exited with status 1

Removing the folder fixes the issue.

LDC does not have this problem and it links fine.

dmd --version
DMD64 D Compiler v2.096.1-dirty

Output of dmd -v:

With the folder (linking fails with above error)
c:\D\dmd2\windows\bin64\lld-link.exe /NOLOGO "app.obj" /OUT:"app.exe" 
/DEFAULTLIB:phobos64 /DEBUG  /LIBPATH:"C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\lib\amd64"
/LIBPATH:"C:\D\dmd2\windows\bin\..\lib64\mingw"

And without (links fine)
c:\D\dmd2\windows\bin64\lld-link.exe /NOLOGO "app.obj" /OUT:"app.exe" 
/DEFAULTLIB:phobos64 /DEBUG  /LIBPATH:"c:\D\dmd2\windows\bin64\..\lib64\mingw"

--