This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/81888] New: Structured bindings stopped working


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]