[Bug c++/84126] [8 Regression] ICE in variadic generic lambda inside a template function calling a function with arguments by reference

2018-02-02 Thread benni.buch at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84126

Benjamin Buch  changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Benjamin Buch  ---
I've checked it again and this bug seems not to be related, I do a separate
report.

[Bug c++/84126] [8 Regression] ICE in variadic generic lambda inside a template function calling a function with arguments by reference

2018-02-02 Thread benni.buch at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84126

Benjamin Buch  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #6 from Benjamin Buch  ---
Thanks for fixing!

Found a variable template version that is still broken:


template 
void sink(Ts...){}

template 
int bar(T&){} // ICE with reference, work with just T

template 
auto var = [](auto ... k){
sink(bar(k) ...);
}(0);


int main() {
var;
}


$ g++ -std=c++14 main2.cpp
main2.cpp: In function 'int bar(T&)':
main2.cpp:5:13: warning: no return statement in function returning non-void
[-Wreturn-type]
 int bar(T&){} // ICE with reference, work with just T
 ^
main2.cpp: In instantiation of ' [with auto:1 = {int}]':
main2.cpp:10:6:   required from 'auto var'
main2.cpp:14:5:   required from here
main2.cpp:9:13: internal compiler error: Segmentation fault
 sink(bar(k) ...);
 ^~~~
0xe79ecf crash_signal
../../gcc/gcc/toplev.c:325
0x916d50 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
../../gcc/gcc/tree.h:3245
0x916d50 enclosing_instantiation_of
../../gcc/gcc/cp/pt.c:12694
0x942a7e tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:11450
0x927dcd tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:17684
0x934e29 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:17100
0x934e29 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16838
0x933950 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16059
0x931f41 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16322
0x931f41 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16322
0x931f41 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16322
0x9311d8 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:16030
0x9311d8 instantiate_decl(tree_node*, bool, bool)
../../gcc/gcc/cp/pt.c:23384
0x87aeeb maybe_instantiate_decl
../../gcc/gcc/cp/decl2.c:5178
0x87ccf8 mark_used(tree_node*, int)
../../gcc/gcc/cp/decl2.c:5273
0x7e7c90 build_over_call
../../gcc/gcc/cp/call.c:8201
0x7f5f1c build_op_call_1
../../gcc/gcc/cp/call.c:4567
0x7f5f1c build_op_call(tree_node*, vec**, int)
../../gcc/gcc/cp/call.c:4596
0x970075 finish_call_expr(tree_node*, vec**, bool,
bool, int)
../../gcc/gcc/cp/semantics.c:2506
0x92849e tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:17874
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.


$ g++ --version
g++ (GCC) 8.0.1 20180202 (experimental)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[Bug c++/84126] [8 Regression] ICE in variadic generic lambda inside a template function calling a function with arguments by reference

2018-02-01 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84126

Jason Merrill  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Jason Merrill  ---
Fixed.

[Bug c++/84126] [8 Regression] ICE in variadic generic lambda inside a template function calling a function with arguments by reference

2018-02-01 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84126

--- Comment #4 from Jason Merrill  ---
Author: jason
Date: Thu Feb  1 18:44:41 2018
New Revision: 257307

URL: https://gcc.gnu.org/viewcvs?rev=257307=gcc=rev
Log:
PR c++/84126 - ICE with variadic generic lambda

PR c++/84036
PR c++/82249
* pt.c (tsubst_pack_expansion): Handle function parameter_packs in
PACK_EXPANSION_EXTRA_ARGS.

Added:
trunk/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic9.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/pt.c

[Bug c++/84126] [8 Regression] ICE in variadic generic lambda inside a template function calling a function with arguments by reference

2018-01-30 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84126

--- Comment #3 from Jason Merrill  ---
C++14 version:

template 
void sink(Ts...);

template 
int bar(T&); // ICE with reference, work with just T

template 
void foo(T){
  [](auto ... k){
sink (bar(k) ...);
  }(0);
}

int main() {
  foo(0);
}

[Bug c++/84126] [8 Regression] ICE in variadic generic lambda inside a template function calling a function with arguments by reference

2018-01-30 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84126

Jason Merrill  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||jason at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |jason at gcc dot gnu.org

[Bug c++/84126] [8 Regression] ICE in variadic generic lambda inside a template function calling a function with arguments by reference

2018-01-30 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84126

--- Comment #2 from Marek Polacek  ---
Started with r257018:

commit 2100de5308865b06be2b235ed159b5af9a9a67a5
Author: jason 
Date:   Wed Jan 24 15:20:53 2018 +

PR c++/82249 - wrong mismatched pack length error.

* pt.c (extract_fnparm_pack, tsubst_pack_expansion): Handle
unsubstituted function parameter pack.

[Bug c++/84126] [8 Regression] ICE in variadic generic lambda inside a template function calling a function with arguments by reference

2018-01-30 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84126

Marek Polacek  changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-01-30
 CC||mpolacek at gcc dot gnu.org
   Target Milestone|--- |8.0
 Ever confirmed|0   |1

--- Comment #1 from Marek Polacek  ---
Confirmed.