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

icpc 14.0 compiler bug (array)

Johnny_W_
Beginner
640 Views

Another compiler bug in icpc 14, reporting here because I can't access premier

[build@fc19jslave09 ~]$ cat u.cpp
#include <array>
#include <string>

std::array<std::string, 2> priority_names =
{
  {
     std::string("NOT USED"),
     "P_PANIC"
  }
};

std::string t (uint32_t prop)
{
   uint32_t log = 0;

    for (; prop > 1; ++log)
      prop >>= 1;

    return priority_names[log];
  }

[build@fc19jslave09 ~]$ g++ -std=c++11 -c u.cpp
[build@fc19jslave09 ~]$ icpc -std=c++0x -c u.cpp
/usr/include/c++/4.8.1/array(162): error: a constexpr member function is only permitted in a literal class type
        size() const noexcept { return _Nm; }
        ^
          detected during instantiation of class "std::array<_Tp, _Nm> [with _Tp=std::string, _Nm=2UL]" at line 4 of "u.cpp"

compilation aborted for u.cpp (code 2)
[build@fc19jslave09 ~]$ icpc --version
icpc (ICC) 14.0.0 20130728
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.

[build@fc19jslave09 ~]$ g++ --version
g++ (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

0 Kudos
6 Replies
Johnny_W_
Beginner
640 Views

This was done on a Fedora 19 system, that ships with GCC 4.8.1 as compiler out of the box

0 Kudos
SergeyKostrov
Valued Contributor II
640 Views
The thread's title looks the same as your another thread ( icpc 14.0 compiler bug / without ( array ) ) but I see now that the problem is different.
0 Kudos
Johnny_W_
Beginner
640 Views

Yes, 2 blocking issues I reproduced in a few minutes after trying the recent release on our TAOX11 product.

0 Kudos
QIAOMIN_Q_
New Contributor I
640 Views

I think if you try to compile the testcase such as

'#include <array>
struct A { A(int); };
const std::array<A, 4> x = {{ 1, 1, 1, 1 }};'

would also get the 'error: a constexpr member function is only permitted in a literal class type' ,need a bug report then.

0 Kudos
Johnny_W_
Beginner
640 Views

Yes, formally reported as bug to Intel support.

0 Kudos
QIAOMIN_Q_
New Contributor I
640 Views

Hello John,

This is a GUN compatability issue and will be fixed in the 14.0 update1.Thanks for your issue submission.

Regards,

--
QIAOMIN.Q
Intel Developer Support

0 Kudos
Reply