Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Can't compile Clang on windows using Visual Studio 2015 preview #23310

Open Quuxplusone opened 9 years ago

Quuxplusone commented 9 years ago
Bugzilla Link PR23311
Status NEW
Importance P normal
Reported by Ernest Galbrun (ernest.galbrun@gmail.com)
Reported on 2015-04-22 07:05:51 -0700
Last modified on 2015-04-22 08:51:19 -0700
Version trunk
Hardware PC Windows NT
CC klimek@google.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also

When trying to compile clang with Visual Studio 2015 preview, I get the following error when compiling RecordLayoutBuilder.cpp (in clangAST) :

RecordLayoutBuilder.cpp(2981) error C2678: binary '==': no operator found which takes a left-hand operand of type 'llvm::DenseMapIterator<KeyT,ValueT,KeyInfoT,BucketT,false>' (or there is no acceptable conversion) (...) while trying to match the argument list '(llvm::DenseMapIterator<KeyT,ValueT,KeyInfoT,BucketT,false>, llvm::DenseMapIterator<KeyT,ValueT,KeyInfoT,BucketT,false>)'

The compiler seem to complain because the egality-comparison operator is only defined for RHS maps of type llvm::DenseMapIterator<KeyT,ValueT,KeyInfoT,BucketT,true>

I have solved the problem by replacing the comparison operator in DenseMap.h, lines 1039-1054 so that they can take input of any DenseMapIterator, not only ConstIterator.

Quuxplusone commented 9 years ago
After further investigation, it seems that there should be a conversion
available from
DenseMapIterator<KeyT,ValueT,KeyInfoT,BucketT,false> to
DenseMapIterator<KeyT,ValueT,KeyInfoT,BucketT,true>

I don't know why it is not chosen here, the comments tell about some SFINAE
taking place here I don't see how but maybe that's the reason since VS doesn't
support SFINAE?
Quuxplusone commented 9 years ago
After a few more tests, it appears that the problem lies indeed in the fact
that the constructor DenseMap<true>(const DenseMap<false>&) is not accessible.
This can be tested by trying to create a DenseMap::const_iterator from a
DenseMap::iterator.

Interestingly enough, when I try this exact same operation elsewhere in the
code (for example in AArch64AddressTypePromotion.cpp, where a DenseMap<Value *,
Instruction *> is used) it functions as expected...