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

Constexpr constructor in constexpr function in template instantiation

Rendaw_R_
Beginner
361 Views

The following compiles with g++ 4.8 and clang++ 3.3 but not with the intel compiler: i

[cpp]

struct A { };
template <int> struct B { };

constexpr int Z(A) { return 0; }
B<Z(A())> b;

int main(int, char**) { return 0; }

[/cpp]

Error:

[plain]

fsandrew@localhost 23$/opt/intel/bin/icc -std=c++11 constexprtest.cxx
constexprtest.cxx(5): error: expression must have a constant value
  B<Z(A())> b;
      ^

constexprtest.cxx(5): error: expression must have a constant value
  B<Z(A())> b;
    ^

compilation aborted for constexprtest.cxx (code 2)
[/plain]

I'm running icc version 13.1.3 (gcc version 4.7.0 compatibility), downloaded today.


0 Kudos
1 Reply
Amanda_S_Intel
Employee
361 Views

I tested this against our beta update 1 build and it compiles without errror. This is fixed in the next release.

0 Kudos
Reply