[Issue 17766] New: Wrong choice of generic mutable/const/immutable methods

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

  Issue ID: 17766
   Summary: Wrong choice of generic mutable/const/immutable
methods
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: ilyayaroshe...@gmail.com

static struct Foo()
{
char opIndex(Indexes...)(Indexes indexes) immutable
{
return 'i';
}

char opIndex()() const
{
return 'c';
}

char opIndex(Indexes...)(Indexes indexes)
{
return 'm';
}
}
pragma(msg, Foo!()()[]);
pragma(msg, (cast(const) Foo!()())[]);
pragma(msg, (cast(immutable) Foo!()())[]);

Prints
'c'
'c'
'c'

But shuold be

'm'
'c'
'i'

Type qualifier should have priority.

--


[Issue 17765] New: void initialisation of out parameters

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

  Issue ID: 17765
   Summary: void initialisation of out parameters
   Product: D
   Version: D2
  Hardware: x86
OS: Mac OS X
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: iamthewilsona...@hotmail.com

Out variables are always initialised, but when they are large static arrays
this incurs a performance penalty. For declaration of regular variables we have
= void to stop default initialisation. This does not work for out variables.
This ER suggests to make `i` valid syntax to suppress initialisation of the out
variable.  

enum M = 2600;
void f() {
float[M] mean = void; // works as expected, mean is left uninitialised
}

void g(out float[M][M] corr) // works but assigns twice
{
corr[] = float.init; // compiler inserted

// assign to each value of corr
}

// only assigns once but does not signal intention like out does
// also is valid to read from `corr` as opposed to write only like `g`
void h(ref float[M][M] corr) 
{
// assign to each value of corr
}

//Error: found ')' when expecting '.' following void
void i(out float[M][M] corr = void)
{
// assign to each value of corr
}

--


[Issue 10523] Don't call array op functions for short vector ops

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

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

https://github.com/dlang/dmd/commit/80513b41f815b4cc77fa279f63ea0feaad358041
convert array ops to library calls

- capture expression tree as reverse polish notation
- pass scalar subtrees as single argument
- fixes Issue 10523 - don't call array op functions for short vector ops

--


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

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

ZombineDev  changed:

   What|Removed |Added

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

--- Comment #1 from ZombineDev  ---
Typo: the last lines were meant to be:

$ dmd -dip1000 scope_bug2.d
$ echo $?
0

$ dmd --version
DMD64 D Compiler v2.076.0-b1-master-32bb4ed

--


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

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

  Issue ID: 17764
   Summary: [scope][DIP1000] Escape checker defeated by
composition transformations
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: major
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: petar.p.ki...@gmail.com

At first I was about to name this issue "The compiler treats 'scope ref T' and
'scope ref T[1]' differently" (see `use0x3()` and `use0x4()`), but then I
decided to dig a little more, so here's what I've found so far:

$ cat > scope_bug.d << DBUG
@safe:
struct Context0x0 { char[]   str; }

struct Parent0x1 { Context0x0  c; }
struct Parent0x2 { Context0x0[1] csa; }
struct Parent0x3 { Context0x0[]  csl; }
struct Parent0x4 { Context0x0*cp; }

struct Parent0x5 { Parent0x1  p1; }
struct Parent0x6 { Parent0x5  p5; }
struct Parent0x7 { Parent0x6  p6; }

struct Parent0x8 { Parent0x2[1]*  p2; }
struct Parent0x9 { Parent0x8[1]   p8; }
struct Parent0xA { Parent0x9[1]   p9; }

struct Parent0xB { Parent0x4* p4; }
struct Parent0xC { Parent0xB* pb; }
struct Parent0xD { Parent0xC* pc; }

void main()
{
char[16] buf;
use0x0(buf);

char[] charSlice = buf;
use0x1(charSlice);

// use0x2(); // NG - rejects valid

Context0x0[1] c = Context0x0(charSlice);

use0x3(c[0]);
use0x4(c);
use0x5(c);

auto p1 = Parent0x1(c[0]);
use0x6(p1);

auto p2 = Parent0x2(c);
use0x7(p2);

Context0x0[] contextSlice = c[];
auto p3 = Parent0x3(contextSlice);
use0x8(p3);

auto p4 = Parent0x4([0]);
use0x9(p4);

auto p5 = Parent0x7(Parent0x6(Parent0x5(p1)));
use0xA(p5);

Parent0x2[1] p2sa = Parent0x2(c);
Parent0xA p6 = Parent0xA(Parent0x9(Parent0x8()));
use0xB(p6);

// auto pbAttemp1 = Parent0xB(); // NG - rejects valid
Parent0x4[1] p4WorkAround = Parent0x4([0]);
Parent0xB[1] pb = Parent0xB([0]);
Parent0xC[1] pc = Parent0xC([0]);
Parent0xD[1] pd = Parent0xD([0]);
use0xC(pd[0]);
}

char[] global;

void use0x0(scope char[] arr)
{
// global = arr; // OK - this does not compile
}

void use0x1(scope ref char[] arr)
{
// global = arr; // OK - this does not compile
}

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

void use0x3(scope ref Context0x0 c)
{
// global = c.str; // OK - this does not compile
}

void use0x4(scope ref Context0x0[1] c)
{
global = c[0].str; // NG - accepts invalid
}

void use0x5(scope Context0x0[] c)
{
global = c[0].str; // NG - accepts invalid
}

void use0x6(scope ref Parent0x1 p)
{
// global = p.c.str; // OK - this does not compile
}

void use0x7(scope ref Parent0x2 p)
{
global = p.csa[0].str; // NG - accepts invalid
}

void use0x8(scope ref Parent0x3 p)
{
global = p.csl[0].str; // NG - accepts invalid
}

void use0x9(scope ref Parent0x4 p)
{
global = p.cp.str; // NG - accepts invalid
}

void use0xA(scope ref Parent0x7 p)
{
// global = p.p6.p5.p1.c.str; // OK - this does not compile
}

void use0xB(scope ref Parent0xA p)
{
global = (*p.p9[0].p8[0].p2)[0].csa[0].str; // NG - accepts invalid
}

void use0xC(scope ref Parent0xD p)
{
global = p.pc.pb.p4.cp.str; // NG - accepts invalid
}
DBUG

$ dmd -dip1000 scope_bug.d
scope_bug.d(11): Error: cannot take address of scope local c in @safe function
main

$ dmd --version
DMD64 D Compiler v2.076.0-b1-master-32bb4ed

--


[Issue 17762] Cannot compile with clean DMD.

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

Rainer Schuetze  changed:

   What|Removed |Added

   Severity|critical|normal

--- Comment #4 from Rainer Schuetze  ---
BTW: I don't think there is an infected Visual D installer anywhere on the
official download page https://github.com/dlang/visuald/releases

If you think there is a not-falsely reported infected version please report the
link.

--


[Issue 17762] Cannot compile with clean DMD.

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

Rainer Schuetze  changed:

   What|Removed |Added

 CC||r.sagita...@gmx.de

--- Comment #3 from Rainer Schuetze  ---
Please read http://rainers.github.io/visuald/visuald/BuildFromSource.html

Check the appveyor.yml file in case you cannot find some dependencies.

--


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

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

ZombineDev  changed:

   What|Removed |Added

Summary|[scope][DIP1000] Error: |[scope][DIP1000] The
   |"cannot take address of |compiler treats implicit
   |scope local" while passing  |and explicit static array
   |a slice to a scope  |slicing differently
   |parameter   |

--


[Issue 17763] [scope][DIP1000] Error: "cannot take address of scope local" while passing a slice to a scope parameter

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

ZombineDev  changed:

   What|Removed |Added

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

--- Comment #1 from ZombineDev  ---
While previous case was rejects-valid, here's a similar one where the compile
accepts invalid code:

$ cat > scope_bug2.d << DBUG
@safe:
struct Context { char[] str; }

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

Context[] global;

void use(scope ref Context[1] c)
{
// global = c[]; // OK - this does not compile.
global = c;  // NG - this does compile, but it should not
 // as it is equivalent to the one above.
}
DBUG

$ dmd -dip1000 scope_bug2.d
$ echo $?
0

--


[Issue 17763] New: [scope][DIP1000] Error: "cannot take address of scope local" while passing a slice to a scope parameter

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

  Issue ID: 17763
   Summary: [scope][DIP1000] Error: "cannot take address of scope
local" while passing a slice to a scope parameter
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: petar.p.ki...@gmail.com

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. To reproduce:

$ cat > scope_bug.d << DBUG
@safe:
struct Context { char[] str; }
void use(scope Context[] c) { }
void main()
{
char[1] s = '@';
Context[1] c;
c[0].str = s;  // <- If this line is commented, it all works.
c[0] = Context(s); // <- this has the same effect as above.
use(c);// OK - this compiles.
use(c[]);  // NG - doesn't compile, though should be
   // equivalent to the statement above.
}
DBUG

$ dmd -dip1000 scope_bug.d
scope_bug.d(11): Error: cannot take address of scope local c in @safe function
main

$ dmd --version
DMD64 D Compiler v2.076.0-b1-master-32bb4ed

--


[Issue 17763] [scope][DIP1000] Error: "cannot take address of scope local" while passing a slice to a scope parameter

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

ZombineDev  changed:

   What|Removed |Added

   Keywords||safe

--


[Issue 17762] Cannot compile with clean DMD.

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

--- Comment #2 from Vincent  ---
> The official releases for Windows are signed and not infected.

Unfortunately, I already had infected visuald.exe and don't want my bad
experience repeat, whatever you try to convince me.
In any case, it's not bad idea to compile myself; why not?

> > If you distribute product in sources, it's a MUST to describe what 
> > additional packages should be in system
> 
> The release binaries contain everything . Nice run make..

I talk about SOURCES. If I download sources and compile, they SHOULD compile.
If they don't, author should specify what dependencies have to be installed.

--


[Issue 17762] Cannot compile with clean DMD.

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

greenify  changed:

   What|Removed |Added

 CC||greeen...@gmail.com

--- Comment #1 from greenify  ---
> I cannot use precompiled binaries, since author already compromised himself 
> distributing infected DLL.

What???
The official releases for Windows are signed and not infected.
There was an issue with VisualD being FALSELY detected, but that was an issue
on the side of the Antivirus company.

> If you distribute product in sources, it's a MUST to describe what additional 
> packages should be in system

The release binaries contain everything . Nice run make..

--


[Issue 17762] New: Cannot compile with clean DMD.

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

  Issue ID: 17762
   Summary: Cannot compile with clean DMD.
   Product: D
   Version: D2
  Hardware: x86_64
OS: Windows
Status: NEW
  Severity: critical
  Priority: P1
 Component: visuald
  Assignee: nob...@puremagic.com
  Reporter: thor...@gmail.com

I have clean DMD 2.074 installation and some old visuald version. I open
visuald project in VS2015-Ent, compile and... lot of bugs due to lack of
packages:

Error: module completion is in file 'vsi\completion.d' which cannot be read
Error: module windef is in file 'sdk\win32\windef.d' which cannot be read
Error: module commctrl is in file 'sdk\win32\commctrl.d' which cannot be read

If you distribute product in sources, it's a MUST to describe what additional
packages should be in system (better with original URL where you get 'em).

PS
I cannot use precompiled binaries, since author already compromised himself
distributing infected DLL.

--