- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Following code (also attached) compiles fine with clang gcc but fails with an error with icc.
#include <iostream>
struct MyIndex : std::integral_constant<int, -1> {};
struct Dimension {
using Dynamic = MyIndex;
};
template<class T, T Key>
constexpr bool make_true2(const std::integral_constant<T, Key>&)
{
return 1;
}
template<int I>
constexpr int make_true() {
return make_true2(Dimension::Dynamic());
}
template<
int I
, typename std::enable_if<make_true<I>(), int>::type = 0
>
int myfunc() {
return 9;
}
int main() {
std::cout << myfunc<0>() << std::endl;
return 0;
}
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi rnickb,
I've reproduced the issue and submitted to dev team to fix. Thank you very much.
Thanks,
Shenghong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Any progress on this one? I have a similar issue (icc 15.0.0.090) aborts compilation claiming error, or (if changed the code somewhat) crashes with ICE (c++/4.8.1/type_traits(1766): interal error: assertion failed: lower_constant: bad kind (shared/cfe/edgcpfe/lower_il.c, line 5804).
Walter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dev team has proposed below workaround:
Change the code as shown below:
template<
int I
#ifdef OK
, typename std::enable_if<make_true2(Dimension::Dynamic()), int>::type = 0
#else
, typename std::enable_if<make_true<I>(), int>::type = 0
#endif
Thanks,
Reddy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If possible, you may provide your test case, so that we can check whether they are same root cause.
For the issue reported in this thread, it is fixed in mainline.
Thanks,
Shenghong

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page