I've found that ICC works strange on string when function is constexpr.
#include <tuple>
using namespace std;
constexpr int str_len(const char *s) {
return *s ? 1 + str_len(s + 1) : 0;
}
int main() {
constexpr int i = str_len("");
tuple<int, int> t;
get<i>(t) = 1; /// let's set first element of tuple to 1
}
error: expression must have a constant value
get<i>(t) = 1; /// let's set first element of tuple to 1
If we change str_len to this:
constexpr int str_len(const char *s) {
return 0;
}
Then the all is ok. It seems that ICC doesn't support actions on strings in compile time at all. Will it be fixed? GCC correctly works on this.
ICC 13 update 1 on win.




