Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #860 (closed defect: fixed)

Opened 10 years ago

Last modified 8 years ago

opAssign in FilePath

Reported by: keinfarbton Assigned to: kris
Priority: major Milestone: 0.99.9
Component: Tango Version: 0.99.4 Frank
Keywords: Cc:

Description

From http://digitalmars.com/d/1.0/operatoroverloading.html
The assignment operator cannot be overloaded for rvalues that can be implicitly cast to the lvalue type.

Doing so results in a compiler error. But doing it via an alias, as done in tango.io.FilePath?, the compiler does not complain.

But trying to nullify a ref result in compile error:

auto fp = new FilePath( "/tmp" );
fp = null;
t.d(14): Error: overloads FilePath(FilePath path) and FilePath(char[] path) both match argument list for set
t.d(14): function tango.io.FilePath.FilePath.set called with argument types:
        (void*)
matches both:
        tango.io.FilePath.FilePath.set(FilePath)
and:
        tango.io.FilePath.FilePath.set(char[])

Change History

01/19/08 10:30:23 changed by keinfarbton

  • owner changed from sean to kris.
  • component changed from Core Functionality to Tango.

01/19/08 10:44:18 changed by larsivi

  • milestone set to 0.99.5.

This one is unfortunate as the repercussions from removing it are bad.

01/19/08 10:49:58 changed by keinfarbton

tango.text.Text.Text has the same problem.

01/19/08 17:18:46 changed by larsivi

Clearing my mind, I was thinking about static opCall. Know less about opAssign in this case just yet.

02/11/08 01:16:47 changed by kris

  • status changed from new to assigned.
  • milestone changed from 0.99.5 to 0.99.6.

Any suggestions, keinfarbton?

02/11/08 02:08:06 changed by keinfarbton

removing the opAssign?

02/23/08 05:42:54 changed by kris

That would break existing code :(

This appears to be a language issue, and I can't see a way around it since it should be legitimate to use opAssign in this manner.

04/18/08 03:51:46 changed by kris

  • milestone changed from 0.99.6 to 1.0.

Really don't know the best way to approach this

05/24/08 17:25:35 changed by larsivi

  • keywords set to triage.

If this is considered a spec/compiler bug, does a bugzilla report exist?

05/24/08 21:16:47 changed by keinfarbton

05/25/08 14:02:19 changed by larsivi

  • keywords deleted.
  • milestone changed from 1.0 to External Bugs.

Added to ToolchainIssues

08/03/08 19:25:13 changed by kris

Frank - I think perhaps the best way to deal with this is to use tango.io.Path instead, if that is possible?

11/14/08 09:16:01 changed by larsivi

I'm not sure I understand this one - if the opAssign doesn't work, how can it then be used/break anything if removed?

11/09/09 03:14:56 changed by kris

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [5069]) fixes #860 :: opAssign in FilePath?

Removed the alias, though doing so removed the ability to set the path via opAssign()

01/14/10 20:48:34 changed by kris

  • milestone changed from External Bugs to 0.99.9.