[Issue 16536] DMD master does not build on OS X 10.11.6/Xcode 7.3.1

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16536

--- Comment #6 from Jacob Carlborg  ---
I manually patch the compiler by replacing targ_size_t with size_t/d_size_t
where the linker complains. I could create a PR but I don't know if it's the
correct solution.

--


[Issue 16587] split("", "x") should be []

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16587

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

   What|Removed |Added

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

--


[Issue 16587] split("", "x") should be []

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16587

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

https://github.com/dlang/phobos/commit/d6572c2a44d69f449bfe2b07461b2f0a1d6503f9
Fix Issue 16587 - split("", "x") should be ""

This reverts commit b438bf5a0653b616ef6debe2a0dfe247d8fc5928.

https://github.com/dlang/phobos/commit/e3f842d52a3eedc7c8f6a5e75f26de05d5cf1fea
Merge pull request #4836 from CyberShadow/pull-20161003-223010

Fix Issue 16587 - split("", "x") should be ""

--


[Issue 16588] New: uniq's BidirectionalRange behavior is inconsistent with its InputRange behavior

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16588

  Issue ID: 16588
   Summary: uniq's BidirectionalRange behavior is inconsistent
with its InputRange behavior
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: acehr...@yahoo.com

import std.algorithm;

struct S {
int i;
string s;
}

void main() {
auto arr = [ S(1, "a"), S(1, "b"),
 S(2, "c"), S(2, "d")];

// Let's consider just the 'i' member for equality
auto r = arr.uniq!((a, b) => a.i == b.i);

assert(r.equal([S(1, "a"), S(2, "c")]));// makes sense

// Since there are just 2 elements, we expect the following
assert(r.front == S(1, "a"));   // good, consistent
assert(r.back == S(2, "c"));// FAILS

// Instead, the following passes but it's unexpected
assert(r.back == S(2, "d"));
}

Bonus: uniq could take a PickStrategy template parameter so that the caller
could specify which of the unique elements of each sequence to pick, either the
first or the last.

Ali

--


[Issue 16587] split("", "x") should be [""]

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16587

Vladimir Panteleev  changed:

   What|Removed |Added

Summary|split("", "x") should be "" |split("", "x") should be
   ||[""]

--


[Issue 16587] split("", "x") should be []

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16587

Vladimir Panteleev  changed:

   What|Removed |Added

Summary|split("", "x") should be|split("", "x") should be []
   |[""]|

--


[Issue 16536] DMD master does not build on OS X 10.11.6/Xcode 7.3.1

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16536

John Colvin  changed:

   What|Removed |Added

 CC||john.loughran.colvin@gmail.
   ||com

--- Comment #5 from John Colvin  ---
This is preventing testing 2.072.0-b1 on os x.

--


[Issue 15862] dmd thinks functions are strongly pure despite mutable indirections in the return type

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15862

ag0ae...@gmail.com changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|INVALID |---

--- Comment #3 from ag0ae...@gmail.com ---
(In reply to Walter Bright from comment #2)
> This is as designed and intended.
> 
> 1. Mutable indirections in the return type do not affect purity
> determination. Mutability of the parameters does.

Sorry, but this is ridiculous. Reopening. Please explain how on earth the shown
behavior is supposedly acceptable.

> 2. An early design decision was that calling new() inside a pure function is
> an acceptable special case. (Otherwise pure functions would be nearly
> useless.)

This is fine. It follows that the compiler must not consider the result
reusable when a function has a mutable indirection in the return type, even
when it's otherwise pure. A strongly pure function (with const parameters) can
only return an int* by newly allocating it. And then reusing it is disastrous.

--


[Issue 16584] Local import ineffective for mixin templates

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16584

--- Comment #2 from m.bier...@lostmoment.com ---
For the record: the best solution is to import the needed modules within the
mixin:

mixin template bla(string number) {
import func;
uint globalBla = toNumber(number);
}

This keeps within the scope of the mixin body.

--


[Issue 16584] Local import ineffective for mixin templates

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16584

m.bier...@lostmoment.com changed:

   What|Removed |Added

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

--- Comment #1 from m.bier...@lostmoment.com ---
>From the documentation:
"Unlike a template instantiation, a template mixin's body is evaluated within
the scope where the mixin appears, not where the template declaration is
defined."

So this is actually by design. Closed the issue.

--


[Issue 15862] dmd thinks functions are strongly pure despite mutable indirections in the return type

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15862

Walter Bright  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution|--- |INVALID

--- Comment #2 from Walter Bright  ---
This is as designed and intended.

1. Mutable indirections in the return type do not affect purity determination.
Mutability of the parameters does.

2. An early design decision was that calling new() inside a pure function is an
acceptable special case. (Otherwise pure functions would be nearly useless.)

--


[Issue 15735] std.algorithm.iteration.splitter returns empty range

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15735

--- Comment #3 from github-bugzi...@puremagic.com ---
Commit pushed to revert-4030-issue15735 at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/4fa5ff684e946ef82927b6ff3937c27d23470c9a
Revert "Fix issue 15735"

--


[Issue 16586] Implicit casting of enum with explicit int base type fails

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16586

--- Comment #1 from m.bier...@lostmoment.com ---
Current work-around is to explicitly cast all enum members:
int[] ints = [cast(int) IntTypeEnumOne.bla, cast(int) IntTypeEnumTwo.bleh];

--


[Issue 16587] split("", "x") should be ""

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16587

--- Comment #1 from Vladimir Panteleev  ---
Example real-life scenarios:

- Comma-delimited lists in program arguments or configuration files. The string
variables will be empty unless populated, then split afterwards.

- `libPaths ~= environment.get("LIBPATH", null).split(":")` will now search the
current directory.

--


[Issue 16587] New: split("", "x") should be ""

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16587

  Issue ID: 16587
   Summary: split("", "x") should be ""
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: regression
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: thecybersha...@gmail.com

/// test.d ///
import std.string;

void main()
{
assert("".split(",").length == 0);
}
//

Introduced in https://github.com/dlang/phobos/pull/4030.

Additionally, the new behavior is inconsistent:

split("")  => []
split("", ",") => [""]
splitLines("") => []

--


[Issue 16586] New: Implicit casting of enum with explicit int base type fails

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16586

  Issue ID: 16586
   Summary: Implicit casting of enum with explicit int base type
fails
   Product: D
   Version: D2
  Hardware: x86_64
OS: Windows
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: m.bier...@lostmoment.com

Consider the following code:

enum StringTypeEnumOne : string {
bla = "bla"
}

enum StringTypeEnumTwo : string {
bleh = "bleh"
}

enum IntTypeEnumOne : int {
bla = 1
}

enum IntTypeEnumTwo : int {
bleh = 2
}

public void main() {
string[] strings = [StringTypeEnumOne.bla, StringTypeEnumTwo.bleh];
int[] ints = [IntTypeEnumOne.bla, IntTypeEnumTwo.bleh];
}

When compiled the following compilation error is thrown:
src\app.d(19,16): Error: cannot implicitly convert expression
(cast(IntTypeEnumOne)1) of type IntTypeEnumOne to IntTypeEnumTwo

The string members are implicitly cast just fine, however I also expected the
members of the int enum to be cast implicitly because I explicitly defined the
base type of the enum.

--


[Issue 16585] New: dmd thinks function returns unique result despite mutable indirection in parameter

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16585

  Issue ID: 16585
   Summary: dmd thinks function returns unique result despite
mutable indirection in parameter
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Keywords: accepts-invalid
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: ag0ae...@gmail.com


int[] fun(long[] arg) pure
{
return cast(int[]) arg;
}
void main()
{ 
long[] a = [1];
immutable i = fun(a); /* Should be rejected. Only ok when fun(a) is
actually unique. */
immutable copy = i.dup;
assert(copy == i); /* Passes. */
a[0] = 2; /* Affects the immutable i. */
assert(copy == i); /* Fails now. */
}


Possibly related to issue 15862.

--


[Issue 16584] New: Local import ineffective for mixin templates

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16584

  Issue ID: 16584
   Summary: Local import ineffective for mixin templates
   Product: D
   Version: D2
  Hardware: x86_64
OS: Windows
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: m.bier...@lostmoment.com

Consider the following code:
// func.d
module func;

public uint toNumber(string str) {
return str[0];
}

// mixins.d
module mixins;

import func;

mixin template bla(string number) {
uint globalBla = toNumber(number);
}

// app.d
module app;

import mixins;

public void main() {
mixin bla!"aaa";
}

When compiled, the following compilation error is shown:
src\mixins.d(6,19): Error: undefined identifier 'toNumber'
src\app.d(6,2): Error: mixin app.main.bla!"aaa" error instantiating

I expected the import of module 'func' to be only needed at the site of the
mixin declaration, not where the mixin is used.

Publicly importing module 'func' in mixins.d works around the problem, as does
importing module 'func' in app.d.

--


[Issue 16583] New: Static module ctor semantic proposition

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16583

  Issue ID: 16583
   Summary: Static module ctor semantic proposition
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dlang.org
  Assignee: nob...@puremagic.com
  Reporter: b2.t...@gmx.com

I propose that static module constructor/destructor would only happen without
selective import:

import stuff; // static module ctor triggerred
import stuff: Type; // static module ctor not triggerred

--


[Issue 16485] Add trait for determining whether a member variable is static or not

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16485

--- Comment #1 from Jonathan M Davis  ---
https://github.com/dlang/phobos/pull/4834

--


[Issue 16582] [REG2.072.0-b1] ParamterDefaultValueTuple fails to compile for scope paramters

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16582

Sönke Ludwig  changed:

   What|Removed |Added

  Component|dmd |phobos

--


[Issue 16582] New: [REG2.072.0-b1] ParamterDefaultValueTuple fails to compile for scope paramters

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16582

  Issue ID: 16582
   Summary: [REG2.072.0-b1] ParamterDefaultValueTuple fails to
compile for scope paramters
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: regression
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: slud...@outerproduct.org

---
import std.traits;
class C {}
void foo(scope C bar = null) {}
static assert(ParameterDefaultValueTuple!foo[0] == null);
---

For DMD 2.072.0-b1, results in:

.../src/phobos/std/traits.d-mixin-1211(1211): Error: scope variable bar may not
be returned

Works correctly up to 2.071.2

--


[Issue 16581] New: Template shape misdetected in is() expression

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16581

  Issue ID: 16581
   Summary: Template shape misdetected in is() expression
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: and...@erdani.com

Consider:

struct Test(T) {}

template PropagateQualifier(Q)
{
static if (is(Q == immutable(Test!X), X))
alias PropagateQualifier = immutable X;
else static if (is(Q == const Test!X, X))
alias PropagateQualifier = const X;
else static if (is(Q == Test!X, X))
alias PropagateQualifier = X;
else static assert(0);
}

static assert(is(PropagateQualifier!(Test!char) == char));

This fails because PropagateQualifier!(Test!char) yields immutable(cha
r). Shuffling the three cases around reveals that the first is() test always
passes.

Inglorious workaround:

struct Test(T) {}

template PropagateQualifier(Q)
{
static if (is(Q == immutable))
{
static if (is(Q == immutable(Test!X), X))
alias PropagateQualifier = immutable X;
}
else static if (is(Q == const))
{
static if (is(Q == const(Test!X), X))
alias PropagateQualifier = const X;
}
else static if (is(Q == Test!X, X))
alias PropagateQualifier = X;
else static assert(0);
}

static assert(is(PropagateQualifier!(Test!char) == char));
static assert(is(PropagateQualifier!(const(Test!char)) == const char));
static assert(is(PropagateQualifier!(Test!(immutable char)) == immutable
char));

--


[Issue 16572] can't take inout delegate

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16572

--- Comment #4 from anonymous4  ---
Oh, right, we have means to select an overload for delegate, we can reuse it
here too.

--


[Issue 15831] IFTI voldemort type exploding bloat

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15831

--- Comment #14 from anonymous4  ---
For stack trace it should be enough (for this example) mymodule.s.Result.foo
without parameters even, file and line number should be enough to locate it.

--


[Issue 15831] IFTI voldemort type exploding bloat

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15831

Martin Nowak  changed:

   What|Removed |Added

 CC||c...@dawg.eu

--- Comment #13 from Martin Nowak  ---
It's an important issue and should be addressed. Let's work on that for 2.073
which is scheduled for the end of 2016.

Because this will impact many tools in D's ecosystem, we need to proper plan
how to mitigate the impact.

A few points.

- Need to talk to Iain to update gdb's D demangler.

  This will take ages to upstream and end up in distributions.
  Maybe we can should the backref mangling to only very long names in the
beginning? Those are unreadable already and not showing them would rather fix a
few GUIs.

- Should we also try to address other mangling issues?

  Some things like the ambiguity are annoying but not that problematic.
  Also mixing in other changes will only increase the impact and make it harder
to release.
  FWIW this is also not a "new" mangling but an abbreviation of the existing
one.

- We need to fix all our toolings and libraries.

  There are some functions in druntime&phobos that build mangled names (e.g.
for loading shared library symbols).
  At best we can just implement the backref scheme in core.demangle.mangle and
reuse the in phobos.
  We also ship the ddemangle tool and there are other debuggers (at least the
maintained ones need updates).


- OT: I'd like to see a similar abbreviation scheme for core.demangle.demangle,
b/c the full template names in backtraces aren't readable either.
  Would be nicer to have something along the line of `func!(Symbol!(Foo, @2))`.

--


[Issue 16572] can't take inout delegate

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16572

Steven Schveighoffer  changed:

   What|Removed |Added

 CC||schvei...@yahoo.com

--- Comment #3 from Steven Schveighoffer  ---
(In reply to anonymous4 from comment #2)
> A small interaction between contravariance and inout here:
> inout(A) f(inout B b) inout;
> If you resolve the type as A delegate(B) you can't pass const(B) as argument.

You wouldn't be able to take a valid delegate of this. Or at least an
operational one.

The delegate type would have to be something like:

inout(A) delegate(inout B) inout=const

We don't have a way to express this.

As it stands, I think the delegate to this would have to be:

const(A) delegate(const(B) b) const

--


[Issue 16536] DMD master does not build on OS X 10.11.6/Xcode 7.3.1

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16536

Steven Schveighoffer  changed:

   What|Removed |Added

 CC||schvei...@yahoo.com

--


[Issue 16580] [REG 2.072.0-b1] spawnShell segfaults on macOS

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16580

--- Comment #1 from Jacob Carlborg  ---
I should add that this will most likely affect any function inside std.process
that calls "environ".

--


[Issue 16580] New: [REG 2.072.0-b1] spawnShell segfaults on macOS

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16580

  Issue ID: 16580
   Summary: [REG 2.072.0-b1] spawnShell segfaults on macOS
   Product: D
   Version: D2
  Hardware: x86
OS: Mac OS X
Status: NEW
  Severity: regression
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: d...@me.com

The following code:

import std.process;

void main()
{
spawnShell("ls");
}

Compiling and running that with DMD 2.072.0-b1 results in a segmentation fault.
I suspect it's std.process.environ that returns null, due to environPtr not
being initialized due to std_process_shared_static_this not being called [1].

Running inside a debugger:

(lldb) target create "main"
Current executable set to 'main' (x86_64).
(lldb) r
Process 6457 launched: '/Users/jacob/development/d/dlang/dmd/src/main' (x86_64)
Process 6457 stopped
* thread #1: tid = 0x293696, 0x000100046a8a
main`D3std7process7environFNbNdNeZxPPa + 14, queue = 'com.apple.main-thread',
stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x000100046a8a main`D3std7process7environFNbNdNeZxPPa + 14
main`D3std7process7environFNbNdNeZxPPa:
->  0x100046a8a <+14>: movq   (%rcx), %rax
0x100046a8d <+17>: popq   %rbp
0x100046a8e <+18>: retq
0x100046a8f <+19>: nop
(lldb) bt
* thread #1: tid = 0x293696, 0x000100046a8a
main`D3std7process7environFNbNdNeZxPPa + 14, queue = 'com.apple.main-thread',
stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x000100046a8a main`D3std7process7environFNbNdNeZxPPa + 14
frame #1: 0x000100047423 main`D3std7process9createEnvFxHAyaAyabZPxPa +
63
frame #2: 0x000100046d35
main`D3std7process16spawnProcessImplFNexAAaS3std5stdio4FileS3std5stdio4FileS3std5stdio4FilexHAyaAyaE3std7process6ConfigxAaZC3std7process3Pid
+ 677
frame #3: 0x0001000479a8
main`D3std7process10spawnShellFNexAaS3std5stdio4FileS3std5stdio4FileS3std5stdio4FilexHAyaAyaE3std7process6ConfigxAaAyaZC3std7process3Pid
+ 320
frame #4: 0x000118c3 main`_Dmain + 195 at process.d:1021
frame #5: 0x00010001e45c
main`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 40
frame #6: 0x00010001e388
main`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 36
frame #7: 0x00010001e401
main`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZv + 45
frame #8: 0x00010001e388
main`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 36
frame #9: 0x00010001e2ee main`_d_run_main + 498
frame #10: 0x00011982 main`main + 34
frame #11: 0x7fff8a3d25ad libdyld.dylib`start + 1
frame #12: 0x7fff8a3d25ad libdyld.dylib`start + 1

[1] https://github.com/dlang/phobos/blob/master/std/process.d#L135-L138

--


[Issue 15306] Delegates with shared context can have unshared aliasing

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=15306

--- Comment #6 from anonymous4  ---
How about const qualifier?

void f()
{
int i = 42;
auto dg = delegate void() const { i=0; }; //ok?
}

--


[Issue 16265] unittest imports should not be counted as dependencies for static ctors

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16265

--- Comment #1 from anonymous4  ---
But you will still have a cycle when compiling unittests? Then unittest
dependencies can't be possibly ignored.

--


[Issue 16572] can't take inout delegate

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16572

--- Comment #2 from anonymous4  ---
A small interaction between contravariance and inout here:
inout(A) f(inout B b) inout;
If you resolve the type as A delegate(B) you can't pass const(B) as argument.

--


[Issue 16579] ReturnStatement[CallExp(DotVarExp)]: Corrupted runtime on missed manifest constant propagation

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16579

Iain Buclaw  changed:

   What|Removed |Added

 CC||ibuc...@gdcproject.org

--- Comment #1 from Iain Buclaw  ---
Extracted from GDC bug report, a fix for the backend to handle the "bad"
frontend AST is about to be pushed in.

https://bugzilla.gdcproject.org/show_bug.cgi?id=242

--


[Issue 16579] New: ReturnStatement[CallExp(DotVarExp)]: Corrupted runtime on missed manifest constant propagation

2016-10-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16579

  Issue ID: 16579
   Summary: ReturnStatement[CallExp(DotVarExp)]: Corrupted runtime
on missed manifest constant propagation
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: major
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: ibuc...@gdcproject.org

Probably related to issue 16576, if not identical (just another angle of the
same issue).

Working example:
---
struct Thing
{
enum Instance = Thing();
int a = 42;

void iter()
{
import std.stdio;
writeln(this.a);   // Prints "42"
}
}

void main()
{
Thing.Instance.iter;
}
---

Broken example:
---
struct Thing
{
enum Instance = Thing();
int a = 42;

void iter()
{
import std.stdio;
writeln(this.a);   // Prints "0"
}
}

void main()
{
return Thing.Instance.iter;   // Added 'return'
}
---


In the bad code, the frontend gives us a CallExp for:

   Instance.iter()

In the good code, the frontend gives us a CallExp for:

   Thing().iter()

So it looks on the surface that constfold has missed a case where it should
have propagated the manifest 'Instance' into a literal 'Thing()'.

--