Extended Description
The following program results in a crashing clang during compilation when being compiled with -Wuninitialized (see attached log which also includes the clang version used):
#include
template
class ArrayRef {
public:
T* begin() const { return m_begin; }
T* end() const { return m_end; }
private:
T* m_begin;
T* m_end;
};
//static void doIt(std::vector ints) // (A)
static void doIt(ArrayRef ints)
{
// (B) Commenting this line makes the error disappear
unsigned int u = 0;
for (const int& i : ints) ;
// (C)
//for (auto it = ints.begin(), end = ints.end(); it != end; ++it) ;
}
int main(int, char**)
{
}
The crash does not occur, if I
- use std::vector instead of ArrayRef (line A)
- comment line B
- use a traditional for loop with iterators instead of the range-based for
loop (line C)