[Bug c++/83217] New: Compiler segfault: structured binding by reference to a templated type via a pointer

emadwilliam92 at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Nov 29 17:13:00 GMT 2017


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

            Bug ID: 83217
           Summary: Compiler segfault: structured binding by reference to
                    a templated type via a pointer
           Product: gcc
           Version: 7.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: emadwilliam92 at gmail dot com
  Target Milestone: ---

The following code produces a compiler segmentation fault. 

```
template <typename T>
struct Object
{
    T a;
};

int main()
{
    Object<int> *it;
    auto & [k] = *it;
}
```

I'm getting the same error with g++ 7.1 and 7.2, with --std=c++1z on x86. 

Here's the compiler error:

```
<source>: In function 'int main()':
10 : <source>:10:19: internal compiler error: Segmentation fault
     auto & [k] = *it;
                   ^~
mmap: Cannot allocate memory
```


More information about the Gcc-bugs mailing list