Monthly Archives: July 2017

G++ 5.3 Bug

I was just thinking to myself recently that I haven’t found a compiler bug in a while. It’s because I’m doing so much in Python, and I’ve never found a bug in Python (the language).

But I’ve never worked with a C++ compiler where I didn’t find a bug.

And sure enough, just came across one, in GCC 5.3 (Qt 5.8).

auto Zip5 = hasFIPS?
    [&file](size_t row) { return file.Field(row, 6); } :
    [&file](size_t row) { return file.Field(row, 5); };

That fails with:

error: operands to ?: have different types ‘ZipCatalog::Load(const boost::filesystem::path&, const boost::filesystem::path&, const boost::filesystem::path&)::<lambda(size_t)>’ and ‘ZipCatalog::Load(const boost::filesystem::path&, const boost::filesystem::path&, const boost::filesystem::path&)::<lambda(size_t)>’

Compiler bug. Those two types are the same.

(I’ve never found a bug in a C compiler either, though it’s been decades since I wrote any C code.)