Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » C2280
C2280 [message #47586] Thu, 02 February 2017 12:49 Go to next message
NilaT is currently offline  NilaT
Messages: 70
Registered: November 2011
Location: Austria
Member
Hello everyone,

I have another, very urgent question.
I want to compile my project with 2015 sources and MSC15...
Some errors here, some warnings there, not worth be mentioned.
But, one error is very annoying and I can't get rid of it.
It's C2280...
test.cpp (191): error C2280: "Upp::Array<TEST> &Upp::Array<TEST>::operator =(const Upp::Array<TEST> &)" : Es wurde versucht, auf eine gelöschte Funktion zu verweisen


I already found this:
http://stackoverflow.com/questions/31264984/c-compiler-error -c2280-attempting-to-reference-a-deleted-function-in-visual

which says the Array class needs a "= default" constructor and copy constructor or something.
I tried a few things but nothing worked.

Please help.
Very urgent!
Any help appreciated.
Thanks in advance.

PS: Please help me with my other Problem (RPC_METHOD) as well, thank you.
PPS: My exact version of Upp is 10249

//edit: When I change
void operator=(Array&& v)          { if(this != &v) { Free(); vector = pick(v.vector); } }

to
Array& operator=(const Array&) = default;

in Vcont.h, the error won't occur but I don't think this is the right solution...

And then the same error occurs for Upp::XmlNode...
Very annoying...

[Updated on: Thu, 02 February 2017 13:01]

Report message to a moderator

Re: C2280 [message #47592 is a reply to message #47586] Fri, 03 February 2017 11:11 Go to previous messageGo to next message
NilaT is currently offline  NilaT
Messages: 70
Registered: November 2011
Location: Austria
Member
Please?
Re: C2280 [message #47593 is a reply to message #47592] Fri, 03 February 2017 11:55 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1274
Registered: September 2007
Senior Veteran
I Google translated that error to "An attempt was made to refer to a deleted function".

It is not the U++ Array you need to add the = default to, but the class you are using.

It is hard to fix this without seeing the code and if your class is copyable or not, but try something from:

http://www.ultimatepp.org/srcdoc$Core$pick_$en-us.html

rval_default(Foo)
Re: C2280 [message #47595 is a reply to message #47586] Sat, 04 February 2017 01:29 Go to previous messageGo to next message
NilaT is currently offline  NilaT
Messages: 70
Registered: November 2011
Location: Austria
Member
Hello and thanks for your reply.

But it MUST be the U++ Array, as my variables are Array<String> and Array of a own structure.
Even the U++ ArrayMap and XmlNode have this issue.

I can post you some code tomorrow if you want, but I guarantee it won't help here.

Any other suggestions?
I will try the rval_default part tomorrow though
Re: C2280 [message #47600 is a reply to message #47595] Sat, 04 February 2017 21:16 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 912
Registered: August 2007
Location: Russia, Moscow rgn.
Veteran

Most of time this error means you need to write
b = pick(a);
or
b = clone(a);
instead of
b = a;
Re: C2280 [message #47602 is a reply to message #47586] Sun, 05 February 2017 13:50 Go to previous messageGo to next message
NilaT is currently offline  NilaT
Messages: 70
Registered: November 2011
Location: Austria
Member
Thanks Mindtraveller, this seems to do the job.
May you can explain WHY?

Thanks Wink
Re: C2280 [message #47606 is a reply to message #47602] Mon, 06 February 2017 13:15 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 912
Registered: August 2007
Location: Russia, Moscow rgn.
Veteran

http://www.ultimatepp.org/srcdoc$Core$pick_$en-us.html

U++ style of coding insists on explicit definition what you want to do: to clone object or to move it. You mustn't write trivial code like
b = a;
fot U++ objects because it is hard to say whether you want to clone object or pick/move it from a to b.

P.S. It is rather uncommon for C++, but I do personally like this style. It is more strict and less error prone.

[Updated on: Mon, 06 February 2017 13:16]

Report message to a moderator

Re: C2280 [message #47609 is a reply to message #47586] Mon, 06 February 2017 16:31 Go to previous messageGo to next message
NilaT is currently offline  NilaT
Messages: 70
Registered: November 2011
Location: Austria
Member
Thank you, seems clear to me.
This must be something C++11 invented, right?
Because we use 2010 sources as well and there was no need for that.
Now, as we updated to 2015, it must be explicit defined...

Well, however, thank you for your help.
Re: C2280 [message #47619 is a reply to message #47609] Thu, 09 February 2017 20:29 Go to previous message
Didier is currently offline  Didier
Messages: 464
Registered: November 2008
Location: France
Senior Member
Hi,

In fact, the origin of the error is probably readable in the code
==> you may have something like the following:

xxxx operator=(xxxx i) = deleted;

Apparently (I haven't looked precisely) deleted indicates that the code is deprecated but can't be used anymore (it is still present to make it easier to do corrections: if you know what has been removed).

I ran into the same type of error 2 days ago, and all the 'xx operator(const xx t)' where marked deleted ==> notice that only the CONST ones where deleted.
From my point of view these modifications are linked to the management of the move semantics introduced in C++11

[Updated on: Thu, 09 February 2017 20:30]

Report message to a moderator

Previous Topic: RPC_METHOD how to "define"
Next Topic: ASSERT when using ValueMap
Goto Forum:
  


Current Time: Fri Aug 18 18:20:19 CEST 2017

Total time taken to generate the page: 0.01059 seconds