Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 2797

Constexpr constructor in constexpr function in template instantiation

$
0
0

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

struct A { };
template <int> struct B { };
constexpr int Z(A) { return 0; }
B<Z(A())> b;
int main(int, char**) { return 0; }

Error:

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)

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


Viewing all articles
Browse latest Browse all 2797

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>