[Issue 17784] [scope][DIP1000] Confusing error message for escaping local via new-expression

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

ZombineDev  changed:

   What|Removed |Added

   Keywords||diagnostic, safe

--


[Issue 17784] New: [scope][DIP1000] Confusing error message for escaping local via new-expression

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

  Issue ID: 17784
   Summary: [scope][DIP1000] Confusing error message for escaping
local via new-expression
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: petar.p.ki...@gmail.com

With PR https://github.com/dlang/dmd/pull/7101, given the following code:
```
#line 1300

// https://issues.dlang.org/show_bug.cgi?id=17370

void test1300() @safe
{
int i;
auto p = new S1300(&i).oops; // line 1306
}

struct S1300
{
int* oops;
//this(int* p) @safe { oops = p; }
}
```

The compiler produces the following error message:
scope_test.d(1306): Error: returning `& i` escapes a reference to local
variable `i`

Which is confusing to the user, because there are no return statements in the
whole file. I suggest the following error message:

scope_test.d(1306): Error: reference to local variable `i` assigned to
heap-allocated `S1300.oops` with possibly longer lifetime

--


[Issue 17783] New: "invalid" leftmost column string in a delimited string does not compile

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

  Issue ID: 17783
   Summary: "invalid" leftmost column string in a delimited string
does not compile
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: nmtigor.w...@googlemail.com

The following code does not compile:

@safe unittest
{
string str1 = q"DLANG
q"123"
DLANG";
assert( str1 == "q\"123\"\n" );
}

But the following compiles:

@safe unittest
{
string str1 = q"DLANG
 q"123"
DLANG";
assert( str1 == " q\"123\"\n" );
}

--


[Issue 17782] The identifier delimiter of a delimited string can not begin with '_'

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

--- Comment #1 from nmtigor.w...@googlemail.com ---
https://github.com/dlang/dmd/pull/7105

--


[Issue 17782] New: The identifier delimiter of a delimited string can not begin with '_'

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

  Issue ID: 17782
   Summary: The identifier delimiter of a delimited string can not
begin with '_'
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: nmtigor.w...@googlemail.com

The following code does not compile:

@safe unittest
{
string str = q"_DLANG
123
_DLANG";
assert( str == "123\n" );
}

Replacing "_DLANG" with "DLANG", it then compiles.

--


[Issue 17780] Malformed DDOC links in std.range

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

--- Comment #2 from b2.t...@gmx.com ---
(In reply to b2.temp from comment #1)
> and https://dlang.org/phobos/std_range.html#.stride has one too... text
> rendered is not in order ! "as hasLength.std.range.primitives is true."

this one is rendered correctly in the doc distributed with the latest beta but
not those for drop / dropExactly

--


[Issue 17764] [scope][DIP1000] Escape checker defeated by composition transformations

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

Walter Bright  changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com

--- Comment #2 from Walter Bright  ---
Starting with this one:

> void use0x2(scope char[]* arr)
> {
> global = *arr; // NG - accepts invalid
> }

`scope` is not transitive. It applies to the 'head' only. `*arr` is no longer
the head, and `scope` doesn't apply to it. A casual look at the rest of the
cases shows similar.

If you would please filter out all the cases of more than one indirection, I
can look at the rest.

--


[Issue 17763] [scope][DIP1000] The compiler treats implicit and explicit static array slicing differently

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

Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #3 from Walter Bright  ---
(In reply to ZombineDev from comment #0)
> The problem is that the compiler disallows explicitly slicing a static array
> and passing the slice to a scope parameter, while if you rely on the
> implicit slicing it works without a problem.

Let's examine:

> use(c);// OK - this compiles.

The address of c is implicitly taken by its coercion to the parameter type of
Context[]. But this is allowed because the parameter is 'scope', and it cannot
escape.


> use(c[]);  // NG - doesn't compile, though should be
>// equivalent to the statement above.

What's happening here is the semantic analysis is bottom up, meaning `c[]` is
evaluated without regard to what context it appears in. The compiler doesn't
see that the result is being passed as `scope`, and so assumes the worst, and
issues an error.

It is not a bug in the compiler.

Trying to add some form of top down in addition to bottom up is a huge increase
in complexity, and will produce all kinds of weird corner cases. You can reopen
it as an enhancement request if you prefer, but I don't think it is practical
to implement at least in the near future.

--


[Issue 17780] Malformed DDOC links in std.range

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

--- Comment #1 from b2.t...@gmx.com ---
and https://dlang.org/phobos/std_range.html#.stride has one too... text
rendered is not in order ! "as hasLength.std.range.primitives is true."

--


[Issue 17781] New: printing "Shared libraries are not yet supported on OSX." should be optional

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

  Issue ID: 17781
   Summary: printing "Shared libraries are not yet supported on
OSX."  should be optional
   Product: D
   Version: D2
  Hardware: x86
OS: Mac OS X
Status: NEW
  Severity: regression
  Priority: P1
 Component: druntime
  Assignee: nob...@puremagic.com
  Reporter: timothee.co...@gmail.com

although Shared libraries are indeed to 100% supported on OSX, there are
existing use caes that do work, and having this message printed to stderr
(druntime/src/rt/sections_osx_x86_64.d) every time they're being used is
annoying.
Could we have an option to make printing this optional?

classifying it as regression since this wasn't printed before

--


[Issue 17763] [scope][DIP1000] The compiler treats implicit and explicit static array slicing differently

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

Walter Bright  changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com

--- Comment #2 from Walter Bright  ---
(In reply to ZombineDev from comment #1)
> While previous case was rejects-valid, here's a similar one where the
> compile accepts invalid code:

Reducing the case to:

  struct Context { char[] str; }

  void main() {
Context[1] c;
use(c);
  }

  Context[] global;

  void use(scope ref Context[1] c) @safe {
global = c[];
global = c;
  }

and compiling with no flags:

  test1.d(13): Error: address of variable c assigned to global with longer
lifetime
  test1.d(14): Error: address of variable c assigned to global with longer
lifetime

compiling with -dip1000:

  test1.d(13): Error: cannot take address of scope parameter c in @safe
function use
  test1.d(14): Error: address of variable c assigned to global with longer
lifetime

The different messages are because of the different order things happen due to
the rewriting. But the error messages are still there and are correct.

Perhaps you're testing with an older compiler?

--


[Issue 17730] [scope][dip1000] std.algorithm.move can escape references to scope classes

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

Walter Bright  changed:

   What|Removed |Added

Summary|[scope][dip1000] Can escape |[scope][dip1000]
   |references to scope classes |std.algorithm.move can
   |by moving   |escape references to scope
   ||classes

--


[Issue 17730] [scope][dip1000] Can escape references to scope classes by moving

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

Walter Bright  changed:

   What|Removed |Added

 CC||bugzi...@digitalmars.com
  Component|dmd |phobos
   Hardware|x86_64  |All
 OS|Linux   |All

--- Comment #1 from Walter Bright  ---
Breaking it down to the following code:

import std.algorithm;

T moveImpl(T)(ref T source) {
T result = void;
moveEmplace(source, result);
return result;
}

T trustedMoveImpl(T)(ref T source) @trusted {
return moveImpl(source);
}

T move(T)(ref T source) {
// test @safe destructible
static if (__traits(compiles, (T t) @safe {}))
return trustedMoveImpl(source); // this is the path taken
else
return moveImpl(source);
}

class A { }

A makeA() @safe {
scope a = new A();
return move(a);   // should fail
}

The trouble is that moveEmplace() is @system, but trustedMoveImpl() paints it
to be @trusted, thus defeating the scope checks.

Re-categorized as a Phobos issue.

--


[Issue 6495] array(file.byLine()) is a problem

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

b2.t...@gmx.com changed:

   What|Removed |Added

 CC||b2.t...@gmx.com

--- Comment #11 from b2.t...@gmx.com ---
Isn't .byLineCopy fix this issue ?

--


[Issue 9253] Review Phobos algorithms and make them transient-safe where possible

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

b2.t...@gmx.com changed:

   What|Removed |Added

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

--- Comment #4 from b2.t...@gmx.com ---
It looks like a failed initiative, not maintained since > 4 years.
Since summer 2016 and the initiative to put annotations on all the unittest
it's easier to locate the candidates.

--


[Issue 9882] Add UFCS-friendly printing functions

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

b2.t...@gmx.com changed:

   What|Removed |Added

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

--- Comment #9 from b2.t...@gmx.com ---
std.range.tee was added.

--


[Issue 10194] std.variant.Variant doesn't call the dtor of struct values

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

b2.t...@gmx.com changed:

   What|Removed |Added

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

--


[Issue 17780] New: Malformed DDOC links in std.range

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

  Issue ID: 17780
   Summary: Malformed DDOC links in std.range
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: b2.t...@gmx.com

See https://dlang.org/phobos/std_range.html#drop
and https://dlang.org/phobos/std_range.html#dropExactly

--


[Issue 11494] std.array.appender is not nothrow

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

b2.t...@gmx.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--


[Issue 5093] improve error for importing std.c.windows.windows

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

b2.t...@gmx.com changed:

   What|Removed |Added

  Component|phobos  |dmd
 OS|Linux   |All

--


[Issue 17779] New: [REG2.075.0] Link failure (undefined references) with std.regex and std.conv

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

  Issue ID: 17779
   Summary: [REG2.075.0] Link failure (undefined references) with
std.regex and std.conv
   Product: D
   Version: D2
  Hardware: All
OS: Linux
Status: NEW
  Keywords: link-failure, rejects-valid
  Severity: regression
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: dlang-bugzi...@thecybershadow.net

 test.d ///
import std.conv;
import std.regex;

void fun(string s = text(0)) {}
enum foo = regex(``);

void main() {}
///

dmd test.d

produces:

test.o: In function
`_D3std4conv17__T6toImplTAyaTiZ6toImplFNaNbNeikE3std5ascii10LetterCaseZAya':
test.d:(.text._D3std4conv17__T6toImplTAyaTiZ6toImplFNaNbNeikE3std5ascii10LetterCaseZAya[_D3std4conv17__T6toImplTAyaTiZ6toImplFNaNbNeikE3std5ascii10LetterCaseZAya]+0x5e):
undefined reference to
`_D3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6Result'
test.o: In function
`_D3std5array96__T5arrayTS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZ5arrayFNaNbNfS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZAa':
test.d:(.text._D3std5array96__T5arrayTS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZ5arrayFNaNbNfS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZAa[_D3std5array96__T5arrayTS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZ5arrayFNaNbNfS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZAa]+0xd):
undefined reference to
`_D3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6Result6lengthMFNaNbNdNiNfZm'
test.d:(.text._D3std5array96__T5arrayTS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZ5arrayFNaNbNfS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZAa[_D3std5array96__T5arrayTS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZ5arrayFNaNbNfS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZAa]+0x4f):
undefined reference to
`_D3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6Result5emptyMFNaNbNdNiNfZb'
test.d:(.text._D3std5array96__T5arrayTS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZ5arrayFNaNbNfS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZAa[_D3std5array96__T5arrayTS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZ5arrayFNaNbNfS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZAa]+0x5c):
undefined reference to
`_D3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6Result5frontMFNaNbNdNiNfZa'
test.d:(.text._D3std5array96__T5arrayTS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZ5arrayFNaNbNfS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZAa[_D3std5array96__T5arrayTS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZ5arrayFNaNbNfS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6ResultZAa]+0x9f):
undefined reference to
`_D3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6Result8popFrontMFNaNbNiNfZv'
test.o: In function
`_D3std4conv110__T8textImplTAyaTAyaTPvTAyaTiTAyaTiTAyaTaTAyaThTAyaThTAyaTbTAyaTbTAyaTbTAyaTbTAyaTbTAyaTbTAyaTAxaTAyaTAxaTAyaZ8textImplFNaNfAyaPvAyaiAyaiAyaaAyahAyahAyabAyabAyabAyabAyabAyabAyaAxaAyaAxaAyaZAya':
test.d:(.text._D3std4conv110__T8textImplTAyaTAyaTPvTAyaTiTAyaTiTAyaTaTAyaThTAyaThTAyaTbTAyaTbTAyaTbTAyaTbTAyaTbTAyaTbTAyaTAxaTAyaTAxaTAyaZ8textImplFNaNfAyaPvAyaiAyaiAyaaAyahAyahAyabAyabAyabAyabAyabAyabAyaAxaAyaAxaAyaZAya[_D3std4conv110__T8textImplTAyaTAyaTPvTAyaTiTAyaTiTAyaTaTAyaThTAyaThTAyaTbTAyaTbTAyaTbTAyaTbTAyaTbTAyaTbTAyaTAxaTAyaTAxaTAyaZ8textImplFNaNfAyaPvAyaiAyaiAyaaAyahAyahAyabAyabAyabAyabAyabAyabAyaAxaAyaAxaAyaZAya]+0xb9):
undefined reference to
`_D3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZS3std4conv47__T7toCharsVii10TaVE3std5ascii10LetterCasei1TiZ7toCharsFNaNbNiNfiZ6Result'
test.d:(.text._D3std4conv110__T8textImplTAyaTAyaTPvTAyaTiTAyaTiTAyaTaTAyaThTAyaThTAyaTbTAyaTbTAyaTbTAyaTbTAyaTbTAyaTbTAyaTAxaTAyaTAxaTAyaZ8textImplFNaNfAyaPvAyaiAyaiAyaaAyahAyahAyabAyabAyabAyabAyabAyabAyaAxaAyaAxaAyaZAya[_D3std4conv110__T8textImplTAyaTAyaTPvTAyaTiTAyaTiTAyaTaTAyaThTAyaThTAyaTbTAyaTbTAyaTbTAyaTbTAyaTbTAyaTbTAyaTAxaTAyaTAxaTAyaZ8textImplFNaNfAyaPvAyaiAyaiAyaaAyahAyahAyabAyabAyabAyabAyabAyabAyaA