Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

ICE on variadic template code

Matthias_Kretz
New Contributor I
476 Views

Compile the following testcase with /opt/intel/composer_xe_2013_sp1.3.174/bin/intel64/icpc -O0 -std=c++11 -c

struct V {
  static constexpr int Size = 1;
};

template <typename To, typename From> inline To cast(From x);

template <int N, int = 1> struct sarray {
  typedef sarray<N / 2> S;
  sarray foo() const { const auto b = d.foo().bar(); }
  sarray bar() const { return {cast<S>(d)}; }
  S d;
};
template <int N> struct sarray<N, N> {
  static constexpr int Size = 1;
  sarray foo() const {}
  sarray bar() const {}
  V d;
};

template <typename To, typename From, typename... Froms>
inline To drop_arguments(Froms..., From, From);

template <typename To, typename From, typename... Froms>
inline To cast(From x, Froms... xs)
{
  using R0 = typename To::S;
  return {drop_arguments<R0, Froms...>(x, xs...)};
}

template <typename To, int N, typename... From>
inline To cast(const sarray<N, N> &x0, const From &... xs)
{
  return cast<To>(x0.d, xs.d...);
}

template <typename To, int N, int M, typename... From>
inline To cast(const sarray<N, M> &x0, const From &... xs)
{
  return cast<To>(x0.d, xs.d..., x0.d, xs.d...);
}

template <typename To, typename From, typename... Froms>
inline To drop_arguments(Froms..., From, From)
{
}

void test() { sarray<8>().foo(); }

​This is the output I get:
​icc-ice.cpp(37): internal error: assertion failed at: "shared/cfe/edgcpfe/func_def.c", line 1576

  {
  ^

compilation aborted for icc-ice.cpp (code 4)

PS: I tried to report this to Intel Premier Support, but once again that site is broken ... :-(

0 Kudos
4 Replies
Hubert_H_Intel
Employee
476 Views

Mathias,

I'll have a look at the ICE. What exactly was the Problem with the Intel Premier Support? Did you see an error message or just a Crash or was your Login rejected?

Regards, Hubert.

0 Kudos
Matthias_Kretz
New Contributor I
476 Views

It said something about an invalid URL and that I should contact my admin. I couldn't make any sense of it...

0 Kudos
Hubert_H_Intel
Employee
476 Views

Matthias,

May have been a temporary problem. I do not see any issue with your account.

Could you please check again if you can log in to: https://premier.intel.com ? Please enter this URL manually, not from a Bookmark you may have stored. If the Problem persists, could you please take a screenshot and send it to me via 'Send Author A Message' link?

Hubert.

0 Kudos
Hubert_H_Intel
Employee
476 Views

Matthias,

I can reprodcue the ICE with your variadic template sample. I'm going to file a defect.

Regards, Hubert

0 Kudos
Reply