Compilers and error messages

So. I typo’ed up some template code the other day. And once again I learned the importance of using several c++ compilers.

Here is a very reduced version of my code:

And let’s start with the compiler I was testing with first.

MSVC (2013 and 2015)

It is not completely clear from that error message what’s going on, so let’s try some other compilers:

GCC (4.9-5.3)

That’s pretty clear. More compilers:

Clang (3.3-3.7)

ICC (13)

(Yes. I mistyped the variable name used for decltype. Replacing the x with t makes it build).

Thanks to http://gcc.godbolt.org/ and http://webcompiler.cloudapp.net/ for testing with various compilers.

One comment on “Compilers and error messages
  1. Derek says:

    You do not need to write ‘ -> decltype(x.first)’ if you can compile your code with ‘-std=c++14’.