[Bug c++/80267] [7 Regression] Compiling aborts when template/auto/lambda occur in some way
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80267 --- Comment #7 from Jason Merrill --- Author: jason Date: Tue May 23 20:51:33 2017 New Revision: 248386 URL: https://gcc.gnu.org/viewcvs?rev=248386&root=gcc&view=rev Log: PR c++/80267 - ICE with nested capture of reference PR c++/60992 * pt.c (tsubst_copy): Handle lookup finding a capture proxy. Added: branches/gcc-6-branch/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested6.C Modified: branches/gcc-6-branch/gcc/cp/ChangeLog branches/gcc-6-branch/gcc/cp/pt.c
[Bug c++/80267] [7 Regression] Compiling aborts when template/auto/lambda occur in some way
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80267 Markus Trippelsdorf changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #6 from Markus Trippelsdorf --- Fixed. Thanks.
[Bug c++/80267] [7 Regression] Compiling aborts when template/auto/lambda occur in some way
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80267 --- Comment #5 from Jason Merrill --- Author: jason Date: Sun Apr 9 05:06:08 2017 New Revision: 246793 URL: https://gcc.gnu.org/viewcvs?rev=246793&root=gcc&view=rev Log: PR c++/80267 - ICE with nested capture of reference PR c++/60992 * pt.c (tsubst_copy): Handle lookup finding a capture proxy. Added: trunk/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested6.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c
[Bug c++/80267] [7 Regression] Compiling aborts when template/auto/lambda occur in some way
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80267 Jason Merrill changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
[Bug c++/80267] [7 Regression] Compiling aborts when template/auto/lambda occur in some way
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80267 --- Comment #4 from Marek Polacek --- Although the problem probably arises in process_outer_var_ref, where with decl_maybe_constant_var_p now returning true for references we take a different path which likely messes things up, but no idea what's going on.
[Bug c++/80267] [7 Regression] Compiling aborts when template/auto/lambda occur in some way
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80267 --- Comment #3 from Marek Polacek --- (I'm using the testcase in Comment 1.) a() is a function template, so when we instantiate it, we call tsubst_expr with args = int to all stuff in BIND_EXPR_BODY of the function. We'll end up calling tsubst_copy for VAR_DECL 'c' in the nested lambda. lookup_name tries to find an instatiation of 'c', but the one it finds has a different context ("auto &c = b;" vs "c;" from the outer lambda), so we ignore that and do r = tsubst_decl (t, args, complain); which created a new VAR_DECL, with DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P = 0. The type of this decl is a reference, so if (decl_maybe_constant_var_p (r)) is true so we do tree init = tsubst_init (DECL_INITIAL (t), r, args, complain, in_decl); and init = maybe_constant_init (init); so INIT is "*b". It's not reduced_constant_expression_p so DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P is left unset. Which means that decl_constant_var_p (r) in the assert doesn't hold and we crash. So there's a discrepancy in DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P for the specializations of 'c'. The original one has it (set in cp_finish_decl -- the initializer "b" is potential_constant_expression), but the second one doesn't have it ("*b" isn't reduced_constant_expression_p.
[Bug c++/80267] [7 Regression] Compiling aborts when template/auto/lambda occur in some way
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80267 Marek Polacek changed: What|Removed |Added CC||mpolacek at gcc dot gnu.org --- Comment #2 from Marek Polacek --- Started with r242422.
[Bug c++/80267] [7 Regression] Compiling aborts when template/auto/lambda occur in some way
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80267 Markus Trippelsdorf changed: What|Removed |Added CC||trippels at gcc dot gnu.org --- Comment #1 from Markus Trippelsdorf --- trippels@gcc75 ~ % cat bug.ii template void a() { int b; auto &c = b; [&] { c; [&] { c; }; }; } void d() { a(); } trippels@gcc75 ~ % g++ -c bug.ii bug.ii: In instantiation of ‘a() [with = int]’: bug.ii:6:7: required from ‘struct a():: [with = int]::’ bug.ii:6:5: required from ‘a():: [with = int]’ bug.ii:4:5: required from ‘struct a() [with = int]::’ bug.ii:4:3: required from ‘void a() [with = int]’ bug.ii:9:19: required from here bug.ii:6:11: internal compiler error: in tsubst_copy, at cp/pt.c:14609
[Bug c++/80267] [7 Regression] Compiling aborts when template/auto/lambda occur in some way
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80267 Richard Biener changed: What|Removed |Added Priority|P3 |P1 Target Milestone|--- |7.0
[Bug c++/80267] [7 Regression] Compiling aborts when template/auto/lambda occur in some way
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80267 Jonathan Wakely changed: What|Removed |Added Keywords||ice-on-valid-code Status|UNCONFIRMED |NEW Last reconfirmed||2017-03-31 Known to work||6.3.0 Summary|Compiling aborts when |[7 Regression] Compiling |template/auto/lambda occur |aborts when |in some way |template/auto/lambda occur ||in some way Ever confirmed|0 |1 Known to fail||7.0