https://bugs.kde.org/show_bug.cgi?id=385768

--- Comment #6 from Craig Tenenbaum <zarathustra.zoroas...@gmail.com> ---
Yeah, I had been wondering why that is and frankly do not understand it, the
offending fragment of code appears to be:

  // Marking a DecompositionDecl as invalid implies all the child BindingDecl's
  // are invalid too.
  if (DecompositionDecl *DD = dyn_cast<DecompositionDecl>(this)) {
    for (BindingDecl *Binding : DD->bindings()) {
      Binding->setInvalidDecl();
    }
  }

in Decl::setInvalidDecl(bool):clang/lib/AST/DeclBase.cpp

The issue is, when not in C++17, the reference returned by `DD->bindings()`
seems to contain a nullptr, which is subsequently dereferenced with
`Binding->setInvalidDecl()`. The resulting segfault should kill just about
anything, right? What kind of insulation the clang driver must have is pretty
special. Unless they somehow avoid being on that codepath entirely or somehow
interfere with the erroneous initialization which must be occurring when
otherwise not in C++17 mode. It has been my experience, thus far, that even
invalid structured bindings do not result in this problem so long as the parser
is in C++17 mode. Why there's no guard-check in that loop or safe
initialization of that reference is as-yet unknown to me. I dunno if this would
be considered sufficient information, yet, to file a bug report upstream.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to