LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 36747 - Structured bindings in conditions crash when using member get
Summary: Structured bindings in conditions crash when using member get
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: C++ (show other bugs)
Version: 6.0
Hardware: PC All
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-14 17:50 PDT by Nicolas Lesser
Modified: 2018-03-24 01:03 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s): r327780


Attachments
Crash log (6.03 KB, text/x-log)
2018-03-14 17:50 PDT, Nicolas Lesser
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Lesser 2018-03-14 17:50:41 PDT
Created attachment 20066 [details]
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.