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

            Bug ID: 103265
           Summary: Default initializer on [[no_unique_address]] member
                    initialized by lambda invoking guaranteed copy elision
                    crashes gcc
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: davidfromonline at gmail dot com
  Target Milestone: ---

The following translation unit

```
struct non_movable {
        non_movable() = default;
        non_movable(non_movable &&) = delete;
};

struct holder {
        holder() {}
        [[no_unique_address]] non_movable m = [] { return non_movable(); }();
};

auto x = holder{};
```

causes gcc to crash with

```
during RTL pass: expand
<source>: In constructor 'holder::holder()':
<source>:7:18: internal compiler error: in assign_temp, at function.c:988
    7 |         holder() {}
      |                  ^
0x205c6d9 internal_error(char const*, ...)
        ???:0
0x7d9c9f fancy_abort(char const*, int, char const*)
        ???:0
0xdf2dfc assign_temp(tree_node*, int, int)
        ???:0
0xc0a642 expand_call(tree_node*, rtx_def*, int)
        ???:0
0xd78607 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```

See it live: https://godbolt.org/z/8oPo1ba1f

Related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98995
  • [Bug c++/103265] New: Defaul... davidfromonline at gmail dot com via Gcc-bugs

Reply via email to