[llvm-bugs] [Bug 36747] New: Structured bindings in conditions crash when using member get

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 14 17:50:41 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=36747

            Bug ID: 36747
           Summary: Structured bindings in conditions crash when using
                    member get
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: blitzrakete at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Created attachment 20066
  --> https://bugs.llvm.org/attachment.cgi?id=20066&action=edit
Crash log

Here's a minimal example that I came up with

// clang++ -std=c++17 -Wbinding-in-condition -o main main.cpp

#include <tuple>

struct X {
  template<int I>
  int get() { return 0; }

  operator bool() { return true; }
};

namespace std {
  template<>
  struct tuple_size<X> { static constexpr std::size_t value = 1; };
  template<>
  struct tuple_element<0, X> { using type = int; };
}

int main() {
  if (auto[a] = X())
    return a;
}

The above crashes with the attached log.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180315/cbaedfb1/attachment.html>


More information about the llvm-bugs mailing list