Bug 6685 – Allow using "with" with rvalues

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-09-17T11:13:00Z
Last change time
2012-02-18T22:09:35Z
Keywords
pull, rejects-valid
Assigned to
yebblies
Creator
dlang-bugzilla

Comments

Comment #0 by dlang-bugzilla — 2011-09-17T11:13:19Z
The most common use of WithStatements in my D1 codebase was: with (someFunction(...)) ... D2 disallows this - for some reason it demands that the expression be an lvalue. I don't see this in the spec, either.
Comment #1 by yebblies — 2011-09-19T18:02:33Z
*** Issue 6694 has been marked as a duplicate of this issue. ***
Comment #2 by yebblies — 2012-02-14T06:47:55Z
https://github.com/D-Programming-Language/dmd/pull/716 This is arguably a bug, I can't find anywhere in the spec that says 'with' only works with lvalues or it must be implemented by taking the address of structs, just that exp must only be evaluated once.
Comment #3 by michal.minich — 2012-02-14T07:13:05Z
(In reply to comment #2) > https://github.com/D-Programming-Language/dmd/pull/716 > > This is arguably a bug, I can't find anywhere in the spec that says 'with' only > works with lvalues or it must be implemented by taking the address of structs, > just that exp must only be evaluated once. This might be related http://d.puremagic.com/issues/show_bug.cgi?id=4350 Does the pull request affect this case?
Comment #4 by yebblies — 2012-02-14T08:01:39Z
(In reply to comment #3) > (In reply to comment #2) > > https://github.com/D-Programming-Language/dmd/pull/716 > > > > This is arguably a bug, I can't find anywhere in the spec that says 'with' only > > works with lvalues or it must be implemented by taking the address of structs, > > just that exp must only be evaluated once. > > This might be related http://d.puremagic.com/issues/show_bug.cgi?id=4350 > Does the pull request affect this case? Unlikely, that looks like an unrelated lookup problem.
Comment #5 by github-bugzilla — 2012-02-18T21:32:49Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/bf611abd06b22e3b1fceb7967c825d13ffbc5258 Merge pull request #716 from yebblies/issue6685 Issue 6685 - Allow using "with" with rvalues