https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117107

            Bug ID: 117107
           Summary: internal compiler error: Segmentation fault at
                    lookup_decomp_type(tree_node*)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yihan4845 at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/dMP9rdf1M

The following program:
```cpp
template <typename, typename>
constexpr bool is_same = false;
template <typename T>
constexpr bool is_same<T, T> = true;

struct tuple {
  template <unsigned long I>
  void check_tuple_like() {
    tuple t;
    auto [v, r] = t;
    (void)[v, r] {
        decltype(v);
    };
  }
  int a = 0;
  int &b = a;
};
```

will trigger segmentation fault for gcc trunk.

The stack dump:
```
0x285c505 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x28702e5 internal_error(char const*, ...)
        ???:0
0xb796f5 lookup_decomp_type(tree_node*)
        ???:0
0xd1e956 finish_decltype_type(tree_node*, bool, int)
        ???:0
0xc989da c_parse_file()
        ???:0
0xdf0599 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```

Reply via email to