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

Generating and modifing constexpr tuples

$
0
0

Intel compiler: icpc (ICC) 17.0.2 20170213
g++: g++ (GCC) 5.4.0
clang++: clang version 3.5.2

The following code compiles with g++ and clang++ but not with the intel compiler (using -std=c++14):

using tuple_type = decltype(std::make_tuple(3));

constexpr tuple_type const_tuple0(std::make_tuple(3));
constexpr tuple_type const_tuple1 {std::make_tuple(3)};
constexpr tuple_type const_tuple2 = std::make_tuple(3);

With c++14 we have the possibility to generate and modify compile-time tuples. Unfortunately the intel compiler doesn't seem to like this and complains with

error: expression must have a constant value

for all three statements. Further investigation showed that any constexpr function returning a tuple won't compile. Returning user-defined constexpr classes from constexpr functions works. So there seems to be a problem in returning constexpr tuples.

Thread Topic: 

Bug Report

Viewing all articles
Browse latest Browse all 1175

Trending Articles



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