|Summary:||Compiler warning C4181: qualifier applied to reference type; ignored|
|Severity:||Compilation Problem||CC:||chtz, crobi, gael.guennebaud, hauke.heibel, jacob.benoit.1, jean.brefort|
|Hardware:||x86 - 32-bit|
Description mailhack 2011-03-07 10:21:23 UTC
Comment 1 Benoit Jacob 2011-03-14 11:11:04 UTC
OK, the line of code in question at OrthoMethods.h:46 is: const typename internal::nested<Derived,2>::type lhs(derived()); This is a typedef so really this warning that you're getting is bogus. Actually it's already in our list of stupid warnings that we disable inside of Eigen, but we don't disable it outside of Eigen. If you want such known-stupid warnings to be permanently disabled, define EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS before including Eigen headers.
Comment 2 Robert Carnecky 2011-08-08 16:22:34 UTC
Created attachment 199 [details] path that fixes the warning The patch adds the const keyword to all versions of the internal::nested<T>::type definition and removes it from all places where internal::nested<T>::type is used.
Comment 3 Robert Carnecky 2011-08-08 16:50:59 UTC
As described in my post to the mailing list , I think this warning is legitimate. I have attached a patch that moves the const keyword to the type definition. A few words on the patch: right now, internal::nested<T>::type always evaluates either to a reference to a const object or to a plain object, but never to a reference to a mutable object. internal::nested<T>::type is sometimes used with the const keyword, sometimes without. After the patch, the const is moved to the type definition, so that all local variables for evaluated nested expressions will be const. Results of the tests with the patch applied: all 21 failtests passed, 560 tests passed, 16 tests did not build (error C2719: formal parameter with __declspec(align('16')) won't be aligned), and 1 test failed (qr_colpivoting3, random failure, cannot reproduce).  http://listengine.tuxfamily.org/lists.tuxfamily.org/eigen/2011/07/msg00042.html
Comment 4 Benoit Jacob 2011-08-09 07:48:02 UTC
First of all, this nested<> template will go away with bug 99. Marking as dependent.
Comment 5 Jean Brefort 2011-10-11 17:23:55 UTC
This warning is not stupid, it just says that the const keyword in this context is useless. You are actually using a reference to a non-const object. g++ does the same thing even if it doesn't complain.
Comment 6 Benoit Jacob 2011-10-11 17:41:09 UTC
Here the constness of the type in question depends on template parameters. In other cases the type may not be const-qualified already. Hence the const keyword here is not useless. Right?
Comment 7 Christoph Hertzberg 2014-06-15 01:05:29 UTC
It seems all those had been fixed meanwhile: https://bitbucket.org/eigen/eigen/commits/479c46d Re-open if any problem persists.
Comment 8 Nobody 2019-12-04 10:29:02 UTC
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/218.