[Patch] bitsetvectortest fails to compile with clang and libc++ (the default on OSX)
The compiler complains as follows:
.../dune/common/test/bitsetvectortest.cc:23:24: error: no viable conversion from
'const_reference' (aka '__bit_const_reference<std::__1::vector<bool, std::__1::allocator<bool> > >') to 'bitset'
(aka 'bitset<4>')
DUNE_UNUSED bitset x = t[0];
^ ~~~~
The code in question reads
typedef typename BBF::const_reference const_reference;
void operator()(const_reference t){
DUNE_UNUSED bitset x = t[0];
}
Here, BBF
is a BitSetVector
, so that the const_reference
t
is a reference to an entry, which is a (4-entry) std::vector<bool>
, thus std::vector<bool>::const_reference
, which can be converted to an std::bitset<4>
.
For some reason, operator()
expects t[0]
, a bool
, to be convertible to a bitset
as well. Which indeed it is with gcc for some reason. Should this really be t[0]
rather than just t
, though, which would make clang
happy?
@@ -20,7 +20,7 @@ struct ConstReferenceOp
typedef typename BBF::const_reference const_reference;
void operator()(const_reference t){
- DUNE_UNUSED bitset x = t[0];
+ DUNE_UNUSED bitset x = t;
}
};