[Bug c++/80908] New: [c++1z] ICE on instantiating a template deducing the noexcept-ness of a function pointer

2017-05-28 Thread hafnermorris at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80908

Bug ID: 80908
   Summary: [c++1z] ICE on instantiating a template deducing the
noexcept-ness of a function pointer
   Product: gcc
   Version: 7.1.1
Status: UNCONFIRMED
  Keywords: ice-on-invalid-code
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hafnermorris at gmail dot com
  Target Milestone: ---

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

The following incorrect code causes an internal compiler error in C++17 mode
starting with gcc 7.1.0:

template
struct S;

template
struct S {
S() {}
};

void f() {}

int main() {
S {};
}

The code is probably incorrect, because it tries to deduce noexcept(bool) and
is rejected by clang in C++17 mode.

Compiler invocation: g++ -std=c++1z example.cpp 
example.cpp: In instantiation of ‘S::S()
[with bool IsNoexcept = false]’:
example.cpp:12:19:   required from here
example.cpp:6:2: internal compiler error: Segmentation fault
  S() {}
  ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.

gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/7.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --
enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty
--with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib
--disable-werror --enable-checking=release
Thread model: posix
gcc version 7.1.1 20170516 (GCC) 


On Wandbox: https://wandbox.org/permlink/xksH3sEPyOThuoiR

[Bug c++/80873] ICE in tsubst_copy when trying to use an overloaded function without a definition in a lambda

2017-05-24 Thread hafnermorris at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80873

--- Comment #2 from Morris Hafner  ---
Created attachment 41413
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41413&action=edit
Minimal example code (valid)

[Bug c++/80873] ICE in tsubst_copy when trying to use an overloaded function without a definition in a lambda

2017-05-24 Thread hafnermorris at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80873

--- Comment #1 from Morris Hafner  ---
I managed to create an example that is a valid program:

struct Buffer {};

auto parse(Buffer b);
template  void parse(T target);

template 
auto field(T target) {
return [&] {
parse(target);
};
}

template 
void parse(T target) {}

auto parse(Buffer b) {
field(0);
}

int main() {
}

[Bug c++/80873] New: ICE in tsubst_copy when trying to use an overloaded function without a definition in a lambda

2017-05-24 Thread hafnermorris at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80873

Bug ID: 80873
   Summary: ICE in tsubst_copy when trying to use an overloaded
function without a definition in a lambda
   Product: gcc
   Version: 7.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hafnermorris at gmail dot com
  Target Milestone: ---

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

The following invalid code causes an ICE:

struct S {};

auto overloaded(S &);

template 
int overloaded(T &) {
return 0;
}

template 
auto returns_lambda(T ¶m) {
return [&] {
overloaded(param);
};
}

int main() {
S s;
returns_lambda(s);
}

On Wandbox:
https://wandbox.org/permlink/bU36doHcn0MoXWrK

Only gcc versions 7.1 and up seem to be affected. No compiler flags are
required.

[Bug c++/79461] [5/6/7 Regression] [C++1z] ICE when capturing a variable in a lambda in a constexpr constructor

2017-02-13 Thread hafnermorris at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79461

--- Comment #2 from Morris Hafner  ---
I can see that the ice-on-invalid-code tag was set. This is only true in C++14
mode, because constexpr lambdas are part of the current C++17 draft (see Bug
70979).
The code is also accepted by the current clang svn in C++1z mode exclusively.

[Bug c++/79461] New: [C++1z] ICE when capturing a variable in a lambda in a constexpr constructor

2017-02-10 Thread hafnermorris at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79461

Bug ID: 79461
   Summary: [C++1z] ICE when capturing a variable in a lambda in a
constexpr constructor
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hafnermorris at gmail dot com
  Target Milestone: ---

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

The following example causes a segmentation fault in gcc 5, 6 and the current
trunk:

struct S {
  constexpr S(int i) {
auto f = [i]{};
  }
};
int main() {}

on Compiler Explorer: https://godbolt.org/g/wlhJ5O

Compiled both with -std=c++14 and -std=c++1z, on a x86-64 Linux machine.