New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 537 - Fails to compile XCode clang 421.11.66 compiler
Fails to compile XCode clang 421.11.66 compiler
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Geometry
3.1
x86 - general Mac OS
: Normal Unknown
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-20 13:22 UTC by Alexey Pelykh
Modified: 2016-03-02 12:24 UTC (History)
4 users (show)



Attachments
A fix tentative (786 bytes, application/octet-stream)
2012-12-20 15:08 UTC, Gael Guennebaud
no flags Details
Patch for Bug 537 (475 bytes, patch)
2016-03-01 18:16 UTC, Aaron Marburg
no flags Details | Diff

Description Alexey Pelykh 2012-12-20 13:22:04 UTC
Quaternion.h contains following line
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(IsAligned)
and IsAligned with value of 0 and compiler complains in mismatched types in template arguments. Probably should be replaced by
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(IsAligned == 0)
to evaluate to 'true' when IsAligned is 0, or false.
Comment 1 Gael Guennebaud 2012-12-20 15:08:00 UTC
Created attachment 307 [details]
A fix tentative

I think this patch should be enough, and needed anyway. If not adding bool(IsAligned) (and not IsAligned==0 !!!) will be the solution.
Comment 2 Aaron Marburg 2016-03-01 18:11:20 UTC
I can replicate this error (still!) with the stable (hq 3.2) branch given trivial test code:

#include <Eigen/Geometry>
template class Eigen::Quaternion<double>;


when compiled with Apple's compiler using either the "-std=c++11" or "-std=c++0x" flags.   When the -std is not specified, the code compiles.   

I discovered this problem under the version of 3.2.8 distributed by homebrew, but have confirmed it in hg.   hg head does not have this bug. 

This is current XCode tools under OSX 10.11.3:

 % g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.3.0
Thread model: posix
Comment 3 Aaron Marburg 2016-03-01 18:16:14 UTC
Created attachment 663 [details]
Patch for Bug 537

Resolves the bug by casting IsAligned to (bool) in the macro.
Comment 4 Gael Guennebaud 2016-03-02 12:24:50 UTC
I cannot reproduce with "Apple LLVM version 7.0.0 (clang-700.1.76)", anyway, those fixes are harmless:

3.2: https://bitbucket.org/eigen/eigen/commits/c45fbc03e711/
devel: https://bitbucket.org/eigen/eigen/commits/0439395336bc/

Note You need to log in before you can comment on or make changes to this bug.