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

Structured bindings not supported by Intel C++ 18.0

$
0
0

According to this table https://software.intel.com/en-us/articles/c17-features-supported-by-intel-c-compiler Intel C++ 18.0 supports structured bindings, but when I compile the code below I get error messages.

#include <tuple>
#include <iostream>
#include <typeinfo>
#include <string>

using namespace std;

int main() {
    tuple<int,string> t(1, "sldkfj");
    auto [i,s] = t;
    cout << i << endl;
    cout << s << endl;
}
matthiash@vector:~/src/utils/test_cpp_features$ /opt/intel/compilers_and_libraries/linux/bin/intel64/icpc --version
icpc (ICC) 18.0.0 20170811
Copyright (C) 1985-2017 Intel Corporation.  All rights reserved.

matthiash@vector:~/src/utils/test_cpp_features$ /opt/intel/compilers_and_libraries/linux/bin/intel64/icpc -std=c++17 -c structured_binding.cpp
structured_binding.cpp(10): error: expected an identifier
      auto [i,s] = t;
           ^

structured_binding.cpp(10): error: identifier "i" is undefined
      auto [i,s] = t;
            ^

structured_binding.cpp(10): error: identifier "s" is undefined
      auto [i,s] = t;
              ^

compilation aborted for structured_binding.cpp (code 2)

Viewing all articles
Browse latest Browse all 1175

Trending Articles



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