[Bug c++/81888] New: Structured bindings stopped working
antoshkka at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Aug 18 14:03:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81888
Bug ID: 81888
Summary: Structured bindings stopped working
Product: gcc
Version: 7.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: antoshkka at gmail dot com
Target Milestone: ---
The following code worked well on GCC-7.1, but fails on GCC-7.2 with
-std=c++17:
struct do_not_define_std_tuple_size_for_me {
bool test1 = true;
};
template <class T>
bool is_structured_bindings_work() noexcept {
auto [a] = T{};
return a;
}
const bool do_not_use =
is_structured_bindings_work<do_not_define_std_tuple_size_for_me>();
Error message:
error: invalid initializer for structured binding declaration
auto [a] = T{};
^~~
Fix from Bug 78939 does not resolves the issue. Clang-4.0 and GCC-7.1 compile
the code well.
More information about the Gcc-bugs
mailing list