- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've found that ICC works strange on string when function is constexpr.
[cpp]
#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
}
[/cpp]
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:
[cpp]
constexpr int str_len(const char *s) {
return 0;
}
[/cpp]
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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi man.
But function result is constant and known at compile time.
So it's compiler mistake.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page