[Issue 12486] Function returning struct isn't called if `enum` of its result is accessed

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

--- Comment #7 from ag0aep6g  ---
*** Issue 18560 has been marked as a duplicate of this issue. ***

--


[Issue 12486] Function returning struct isn't called if `enum` of its result is accessed

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

--- Comment #6 from ag0aep6g  ---
The code from comment 3 still fails. Moved to new issue 18746.

--


[Issue 12486] Function returning struct isn't called if `enum` of its result is accessed

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

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

https://github.com/dlang/dmd/commit/0a6d7c437d6ab1a919e35d383516ab3dc6f2bb49
Add test from bug #12486

https://github.com/dlang/dmd/commit/3cf5d36578ff612654fddb8f0bb679257e5e4f3f
Merge pull request #8013 from
FeepingCreature/fix/12486-dont-discard-expression-on-enum-access

fix Issue 12486 - Function returning struct isn't called if `enum` of its
result is accessed
merged-on-behalf-of: Iain Buclaw 

--


[Issue 12486] Function returning struct isn't called if `enum` of its result is accessed

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

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

   What|Removed |Added

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

--


[Issue 12486] Function returning struct isn't called if `enum` of its result is accessed

2018-03-13 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12486

--- Comment #4 from FeepingCreature  ---
Posted a pull request that's awaiting review:
https://github.com/dlang/dmd/pull/8013

I'm not really happy with it, but I don't know a better way to write it.

--


[Issue 12486] Function returning struct isn't called if `enum` of its result is accessed

2018-03-09 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12486

ag0ae...@gmail.com changed:

   What|Removed |Added

 CC||ag0ae...@gmail.com

--- Comment #3 from ag0ae...@gmail.com ---
Very similar case:


struct S {}

S f(ref int i)
{
++i;
return S();
}

void main()
{
int i = 2;
assert(f(i) == S());
assert(i == 3); // fails, i = 2
}


With the enum, the struct doesn't have to be empty, but here it does.

--


[Issue 12486] Function returning struct isn't called if `enum` of its result is accessed

2018-03-09 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12486

ag0ae...@gmail.com changed:

   What|Removed |Added

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

--


[Issue 12486] Function returning struct isn't called if `enum` of its result is accessed

2018-03-09 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12486

ag0ae...@gmail.com changed:

   What|Removed |Added

 CC||default_357-l...@yahoo.de

--- Comment #2 from ag0ae...@gmail.com ---
*** Issue 18562 has been marked as a duplicate of this issue. ***

--


[Issue 12486] Function returning struct isn't called if `enum` of its result is accessed

2014-07-30 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12486

yebblies  changed:

   What|Removed |Added

 CC||yebbl...@gmail.com

--- Comment #1 from yebblies  ---
I guess this is valid.  It works correctly when a is a static var or a static
function.

--