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

Ticket #860 (assigned defect)

Opened 9 months ago

Last modified 2 months ago

opAssign in FilePath

Reported by: keinfarbton Assigned to: kris (accepted)
Priority: major Milestone: External Bugs
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 05:30:23 changed by keinfarbton

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

01/19/08 05: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 05:49:58 changed by keinfarbton

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

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

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

02/10/08 20: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/10/08 21:08:06 changed by keinfarbton

removing the opAssign?

02/23/08 00: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/17/08 23: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 13: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 17:16:47 changed by keinfarbton

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

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

Added to ToolchainIssues

08/03/08 15: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?