This forum has been archived. All content is frozen. Please use KDE Discuss instead.

compiler warning on vc 2008

Tags: None
(comma "," separated)
grinderfox
Registered Member
Posts
9
Karma
0

compiler warning on vc 2008

Wed Oct 07, 2009 9:27 am
Hi,
I'm using vs 2008 and eigen 2.06. When compiling with warning level 4 (/W4)on, I get the following compiler warning in Functors.h, ln 282:
Code: Select all
warning C4512: 'Eigen::ei_scalar_multiple_op<Scalar>' : assignment operator could not be generated with [ Scalar=double ]

According to MS' website, one could do the following:
1. Explicitly define an assignment operator for the class.
2. Remove const from the data item in the class.
3. Use the #pragma warning statement to suppress the warning.
Option 3 is just pragmatic, but I hate doing this kind of stuff unless i don't have to.
Any thoughts?
best regards,
grinderfox
Hauke
Registered Member
Posts
109
Karma
3
OS

Re: compiler warning on vc 2008  Topic is solved

Wed Oct 07, 2009 11:16 am
I fixed all those warnings in the devel branch. Since they are only occuring with /W4 enabled and since they are not really important, we did not backport them as of now.

In case you desparately need the backport please let me know.

We fixed by adding
Code: Select all
Class& operator=(const Class&);

to the private section of clases where this warning occurs.

Regards,
Hauke
grinderfox
Registered Member
Posts
9
Karma
0

Re: compiler warning on vc 2008

Wed Oct 07, 2009 12:07 pm
Hauke wrote:In case you desparately need the backport please let me know.

It depends, when will the 2.1 be out? :)
thanx for the quick fix...
Just to be sure: for example, if the warning was tied to class CwiseNullaryOp, then all I have to do is add
private:
CwiseNullaryOp& operator=(const CwiseNullaryOp&);
at the end of the CwiseNullaryOp class def?
Hauke
Registered Member
Posts
109
Karma
3
OS

Re: compiler warning on vc 2008

Wed Oct 07, 2009 12:26 pm
grinderfox wrote:I have to do is add
private:
CwiseNullaryOp& operator=(const CwiseNullaryOp&);
at the end of the CwiseNullaryOp class def?

That's right. It nicely emphasizes that the operator is not even generated by the compiler - otherwise you would receive compile errors.

Regarding the release roadmap I am the wrong person to ask - we need some feedback from Gael or Benoit.

- Hauke
User avatar
bjacob
Registered Member
Posts
658
Karma
3

Re: compiler warning on vc 2008

Wed Oct 07, 2009 12:38 pm
The next major version is still far away and will have a more "interesting" name than "eigen 2.1" ;)

I can't speak about this particular issue, I don't have MSVC. We've backported bigger ones than that in the past, but I understand that as it only appears with /W4 it's not a big priority.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
grinderfox
Registered Member
Posts
9
Karma
0

Re: compiler warning on vc 2008

Wed Oct 07, 2009 12:45 pm
Thanx for the answers,
For the sake of clarity:
I've added the following lines in Functors.h:
Code: Select all
...// ei_scalar_multiple_op def
private:
  ei_scalar_multiple_op& operator=(const ei_scalar_multiple_op&);
...
...// ei_scalar_constant_op def
private:
  ei_scalar_constant_op& operator=(const ei_scalar_constant_op&);
...


best regards,
grinderfox
Hauke
Registered Member
Posts
109
Karma
3
OS

Re: compiler warning on vc 2008

Fri Oct 09, 2009 11:15 am
Ok, I just started taking a look at the /W4 warnings in 2.x. Honestly, I am not going to fix them. There are so many warnings that I am amazed you found the assignment issue between all the other ones. My recommendation is to stick to /W4 or wait for the release beyond 2.x.

Cheers,
Hauke
grinderfox
Registered Member
Posts
9
Karma
0

Re: compiler warning on vc 2008

Sat Oct 10, 2009 3:57 pm
Well, I didn't compile the Eigen, I was compiling my project with included Eigen headers, i.e. only #include <Eigen/Core>.
best regards,
grinderfox
Hauke
Registered Member
Posts
109
Karma
3
OS

Re: compiler warning on vc 2008

Wed Oct 14, 2009 6:32 am
FYI, I changed my mind and fixed it.
grinderfox
Registered Member
Posts
9
Karma
0

Re: compiler warning on vc 2008

Wed Oct 14, 2009 9:00 am
Yeah, I've seen it on bitbucket.
thx! ;D
best regards,
grinderfox


Bookmarks



Who is online

Registered users: Bing [Bot], daret, Google [Bot], sandyvee, Sogou [Bot]