Skip to content

Instantly share code, notes, and snippets.

@reupen
Last active June 27, 2018 19:55
Show Gist options
  • Save reupen/52ff0c9a49a8e75bf1c6f272ed09db11 to your computer and use it in GitHub Desktop.
Save reupen/52ff0c9a49a8e75bf1c6f272ed09db11 to your computer and use it in GitHub Desktop.
Structured bindings compiler error with VS2017 15.8 preview 3
// Does not compile with /permissive- /std:c++17
// Yields:
// f:\playground\vc2017\vc2017\moo.cpp(16): error C3861: 'id': identifier not found
// f:\playground\vc2017\vc2017\moo.cpp(16) : error C3861 : 'name' : identifier not found
#include <vector>
#include <tuple>
template<typename Args>
class Moo {
public:
std::vector<std::tuple<unsigned, std::string>> m_data;
void test()
{
// Also, changing auto& to auto&& causes an internal compiler error here
for (auto& [id, moo] : m_data) {
}
}
};
int main()
{
Moo<unsigned>().test();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment