1 |
strcpy_s(dest, strlen(src),src); |
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:
1 2 3 4 5 6 7 8 9 10 |
#include <utility> template <typename T> auto foo(const T& t) -> decltype(x.first) { return t.first; } int main() { foo(std::make_pair(1,2)); return 0; } |
And let’s start with the compiler I was testing with first.
MSVC (2013 and 2015)
1 2 |
main.cpp(8): error C2672: 'foo': no matching overloaded function found main.cpp(8): error C2893: Failed to specialize function template 'unknown-type foo(const T &)' |
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)
1 2 |
2 : error: 'x' was not declared in this scope template <typename T> auto foo(const T& t) -> decltype(x.first) |
That’s pretty clear. More compilers:
Clang (3.3-3.7)
1 2 |
2 : error: use of undeclared identifier 'x' template <typename T> auto foo(const T& t) -> decltype(x.first) |
ICC (13)
1 2 |
example.cpp(2): error: identifier "x" is undefined template <typename T> auto foo(const T& t) -> decltype(x.first) |
(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.
So. KDE has landed at Qt World Summit.
You can come and visit our booth and …
KDE – 19 years of Qt Experience.
So quite some time ago, I filed this. After some going back and forth, it lead to this. And finally we have a conclusion. It took only two years, but now we are there. Let’s continue make Debian rock.
There is more people with blue hair at Debconf than at an average Akademy. KDE – we need to do better :)
Watching people figuring out how to use a Danish cheese slicer is kind interesting. But by using enough force most people succeeding in getting a lump of cheese.
It is still an open question what the Debian Project Leader wears under their kilt.
Recent Comments