Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
7679 Discussions

Structured bindings not supported by Intel C++ 18.0

Matthias_H_3
Beginner
351 Views

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)
0 Kudos
1 Solution
Melanie_B_Intel
Employee
351 Views

That documentation link is wrong, 18.0 is based primarily on EDG 4.13, and we expect structured bindings will become available in EDG 4.14

Thanks for pointing this out, I'll see about getting that link corrected.

View solution in original post

2 Replies
Melanie_B_Intel
Employee
352 Views

That documentation link is wrong, 18.0 is based primarily on EDG 4.13, and we expect structured bindings will become available in EDG 4.14

Thanks for pointing this out, I'll see about getting that link corrected.

Steven_K
Beginner
351 Views

What are the upcoming featuresupport plans exactly? 
Right now the adoption of standards lags quite some way behind of it's progression - compared to other compilers.
constexpr-if support was the least I'd been expecting from the new major release.

Reply