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

            Bug ID: 80559
           Summary: Segmentation fault on invalid initialiser list
                    template arguments
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: matt at godbolt dot org
  Target Milestone: ---

Build: GCC v8.0.0 (built from source 20170428)

The following code:

----
#include <initializer_list>

template <typename T, std::size_t N>
struct Stack_t {};

template<typename T> 
constexpr Stack_t(std::initializer_list<T> l) -> Stack_t<T, l.size()>;
----

Yields the following errors, and ends with mmap() failing to allocate memory:

<source>:7:69: error: template argument 2 is invalid
 constexpr Stack_t(std::initializer_list<T> l) -> Stack_t<T, l.size()>;
                                                                     ^
<source>:7:69: error: template argument 2 is invalid
<source>:7:69: error: template argument 2 is invalid
<source>:7:69: error: template argument 2 is invalid
<source>:7:50: internal compiler error: Segmentation fault
 constexpr Stack_t(std::initializer_list<T> l) -> Stack_t<T, l.size()>;
                                                  ^~~~~~~
mmap: Cannot allocate memory

Reply via email to