www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - .opAssign disabled without disable

reply denizzzka <den den.com> writes:
Hi!

DMD and LDC2 complain about disabled opAssign, but I am not used 
 disable and depend package "gfm" also isn't uses  disable.

Steps to reproduce:

git clone https://github.com/denizzzka/r-tree.git
cd r-tree
git checkout 803eed22
dub test

Fetching gfm 6.0.0 (getting selected version)...
Placing gfm 6.0.0 to /home/denizzz/.dub/packages/...
Generating test runner configuration '__test__library__' for 
'library' (sourceLibrary).
Performing "unittest" build using dmd for x86_64.
gfm:math 6.0.0: building configuration "library"...
r-tree ~master: building configuration "__test__library__"...
source/package.d(109,31): Error: function 
rtree.RAMNode!(Box!(int, 2), ubyte).RAMNode.opAssign is not 
callable because it is annotated with  disable
source/package.d(110,26): Error: function 
rtree.RAMNode!(Box!(int, 2), ubyte).RAMNode.opAssign is not 
callable because it is annotated with  disable
source/package.d(330,25): Error: template instance 
rtree.RTree!(RAMNode!(Box!(int, 2), ubyte), true) error 
instantiating
dmd failed with exit code 1.

If I am try to add opAssign to struct RAMNode manually it is 
compiles. (But there is enough postblit constructor.)
Apr 16 2016
next sibling parent denizzzka <den den.com> writes:
On Saturday, 16 April 2016 at 11:48:56 UTC, denizzzka wrote:

 source/package.d(109,31): Error: function 
 rtree.RAMNode!(Box!(int, 2), ubyte).RAMNode.opAssign is not 
 callable because it is annotated with  disable
 source/package.d(110,26): Error: function 
 rtree.RAMNode!(Box!(int, 2), ubyte).RAMNode.opAssign is not 
 callable because it is annotated with  disable
 source/package.d(330,25): Error: template instance 
 rtree.RTree!(RAMNode!(Box!(int, 2), ubyte), true) error 
 instantiating
Perhaps I should explain that struct RAMNode placed in repository above. (And it isn't contains any disable)
Apr 16 2016
prev sibling parent reply Alex Parrill <initrd.gz gmail.com> writes:
On Saturday, 16 April 2016 at 11:48:56 UTC, denizzzka wrote:
 Hi!

 DMD and LDC2 complain about disabled opAssign, but I am not 
 used  disable and depend package "gfm" also isn't uses  disable.

 ...
Try removing the const from this line: debug private const bool isLeafNode = false; I suspect that D is disabling whole-structure assignment since allowing it would mean that the constant `isLeafNode` could be changed.
Apr 16 2016
parent reply denizzzka <den den.com> writes:
On Saturday, 16 April 2016 at 15:15:18 UTC, Alex Parrill wrote:

 Try removing the const from this line:

 debug private const bool isLeafNode = false;

 I suspect that D is disabling whole-structure assignment since 
 allowing it would mean that the constant `isLeafNode` could be 
 changed.
Tried - is no avail.
Apr 16 2016
parent reply denizzzka <den den.com> writes:
Tried to build small test app - is not reproduced.
Apr 16 2016
parent reply denizzzka <den den.com> writes:
On Sunday, 17 April 2016 at 06:42:39 UTC, denizzzka wrote:
 Tried to build small test app - is not reproduced.
Also tried to reduce source: https://github.com/denizzzka/r-tree/tree/314f7f1cc1b6387915dc56dcb2d3ccbc63e19275/source In this source line 199 causes this error (https://github.com/denizzzka/r-tree/blob/314f7f1cc1b6387915dc56dcb2d3ccbc63e19275/source/package.d#L199) But if I am checkout to master and remove const from debug private const bool isLeafNode = false; It isn't fixes compiling. Second branch: I am removed const from file and add import insted of traits template function: https://github.com/denizzzka/r-tree/blob/4457025efa72a6d8a97429e09c35a3f5520c37d5/source/package.d#L26 If place this import to top of the file disabled error is gone! Why?
Apr 17 2016
parent reply denizzzka <den den.com> writes:
As Alex Parrill says, on problem was in const member. But this is 
one of the problems, and after fix here still was an error.

But alphaglosined found another problem! For some unknown reason 
here it is need to specify an empty postblit constructor.

Full patch:
https://github.com/denizzzka/r-tree/commit/ca9231df5a8a227aa9a8010b849e2e92a134f8a1

So, my problem is solved. But nevertheless maybe here is a 
problem in the compiler too.
Apr 17 2016
parent ag0aep6g <anonymous example.com> writes:
On 17.04.2016 13:00, denizzzka wrote:
 So, my problem is solved. But nevertheless maybe here is a problem in
 the compiler too.
I've reduced the test case and filed an issue: https://issues.dlang.org/show_bug.cgi?id=15936
Apr 17 2016