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

"Internal error: assertion failed" in static constexpr code

Gupta__Sandeep
Beginner
550 Views

Hi,

I am trying to compile the following code with icpc 16.0.3. And I am getting an internal assertion failure error:

Internal error: assertion failed at: "shared/cfe/edgcpfe/decl_spec.c", line 9392

Here is a minimal sample code to re-produce it (and also a workaround that I am currently using)

#include <iostream>

struct MiddleEarth
{
   static constexpr char wizard[] = "Gandalf";
};
constexpr char MiddleEarth::wizard[];

template <typename T> struct Numenor
{
   static constexpr char king[] = "pharazon";
   /* static const char king[]; */ // workaround
};

template <typename T>
constexpr char Numenor<T>::king[];

// workaround
/* template <typename T> */
/* const char Numenor<T>::king[] = "pharazon"; */

int main(int argc, char *argv[])
{
   std::cout << "The greatest wizard is " << MiddleEarth::wizard << std::endl; // works
   std::cout << "The greatest king is "   << Numenor<int>::king  << std::endl; // fails return 0;
}

0 Kudos
3 Replies
Judith_W_Intel
Employee
550 Views

 

I cannot reproduce this assertion failure with our latest 16.0 compiler.

I'm pretty sure this was fixed on 5/10 by the fix for DPD20038225 which allows a flexible array member type as a constexpr variable.

16.0 update 4 should available soon so please confirm that it is fixed.

Sorry for the inconvenience.

 

 

0 Kudos
Gupta__Sandeep
Beginner
550 Views

Judith,

The above issue is NOT present in 16.0.1, but is there in 16.0.2 and 16.0.3, so it looks like a regression.

 

 

0 Kudos
Judith_W_Intel
Employee
550 Views

 

Yes that is true. The  cq number is DPD200382225 which was a regression from the fix for DPD200374125 which went into 16.0 on 12/7/2015.

Sorry for the inconvenience.

0 Kudos
Reply