[Bug c++/82218] New: [C++1x] constexpr on static member function causes segfault

2017-09-14 Thread emil.fresk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82218

Bug ID: 82218
   Summary: [C++1x] constexpr on static member function causes
segfault
   Product: gcc
   Version: 6.3.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: emil.fresk at gmail dot com
  Target Milestone: ---

The constexpr on line 55 in Compiler Explorer https://godbolt.org/g/sJA8nK
causes the segfault.
By removing this, it compiles fine.
The error is tested in 6.3.0 and 6.3.1, where it exists. 
Found on arm-none-eabi-gcc 6.3.1 on Ubuntu 16.04, reproduced on the normal GCC
6.3.x.
Not triggered any more in GCC 7.1 and 7.2.



Full error message:
: In instantiation of 'static constexpr R delegate::invoke_function(void*, Params ...) [with R (* Fptr)(Params ...) =
delegate::error_function; R = void; Params = {}]':
103 : :103:12:   required from 'static constexpr auto delegate::from() [with R (* Fptr)(Params ...) = delegate::error_function; R = void; Params = {}]'
72 : :72:35:   required from 'delegate::delegate() [with
R = void; Params = {}]'
134 : :134:24:   required from here
43 : :43:23:   in constexpr expansion of 'delegate::error_function()'
42 : :42:22: internal compiler error: Segmentation fault
   constexpr static R invoke_function(void*, Params... params) noexcept(
  ^~~
mmap: Cannot allocate memory
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Compiler exited with result code 1

[Bug c++/82218] [C++1x] constexpr on static member function causes segfault

2017-09-14 Thread emil.fresk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82218

--- Comment #1 from Emil Fresk  ---
Moreover, if one changes so Params... type-pack is not void it also compiles
fine. The use of void seems to be the part causing the problem.

This can be tested by changing void(void) to void(int) on line 134, and adding
an argument to a(), on line 138, for example a(10).