[Bug c++/79457] Segmentation fault in templated decltype evaluation

2017-02-10 Thread teemu at hecknology dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79457

--- Comment #2 from Teemu Piippo  ---
Created attachment 40716
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40716&action=edit
Minimal example that does not crash

[Bug c++/79457] Segmentation fault in templated decltype evaluation

2017-02-10 Thread teemu at hecknology dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79457

--- Comment #1 from Teemu Piippo  ---
If the "S" declaration is removed and the decltype(...) moved into the return
type of Foo::boo(), GCC does not crash and builds the example properly.

[Bug c++/79457] New: Segmentation fault in templated decltype evaluation

2017-02-10 Thread teemu at hecknology dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79457

Bug ID: 79457
   Summary: Segmentation fault in templated decltype evaluation
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: teemu at hecknology dot net
  Target Milestone: ---

Created attachment 40715
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40715&action=edit
Minimal example

GCC crashes compiling the attached source file. Clang builds the code in
question properly.

[ teemu@apotheosis ~/crash ]$ /usr/lib/gcc-snapshot/bin/g++ bug.cpp -std=c++11
-save-temps
bug.cpp: In substitution of 'template template using S =
decltype (((Foo*)(void)0)->Foo::goo[R()]) [with R = R; T = T]':
bug.cpp:13:5:   required from here
bug.cpp:7:21: internal compiler error: in lookup_member, at cp/search.c:1256
  using S = decltype(goo[R()]);
 ^~~

Version information (of gcc-snapshot; the example also crashes just the same in
default distribution-provided g++ 6.2.0):

[ teemu@apotheosis ~/crash ]$ /usr/lib/gcc-snapshot/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/usr/lib/gcc-snapshot/bin/g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc-snapshot/libexec/gcc/x86_64-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
20161006-1ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs
--enable-languages=c,ada,c++,go,fortran,objc,obj-c++
--prefix=/usr/lib/gcc-snapshot --program-prefix= --enable-shared
--enable-linker-build-id --disable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie
--with-system-zlib --enable-objc-gc --enable-multiarch --disable-werror
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic --enable-checking=yes
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.0.0 20161006 (experimental) [trunk revision 240826] (Ubuntu
20161006-1ubuntu1)
[ teemu@apotheosis ~/crash ]$ uname -a
Linux apotheosis 4.8.0-37-generic #39-Ubuntu SMP Thu Jan 26 02:27:07 UTC 2017
x86_64 x86_64 x86_64 GNU/Linux
[ teemu@apotheosis ~/crash ]$ cat /etc/issue
Ubuntu 16.10 \n \l