[Bug c++/64382] ICE due to use of `this` inside a lambda that captures everything by ref inside a member function of a class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64382 Adam Butcher changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #8 from Adam Butcher --- Fixed for 7.
[Bug c++/64382] ICE due to use of `this` inside a lambda that captures everything by ref inside a member function of a class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64382 --- Comment #7 from Adam Butcher --- Author: abutcher Date: Fri Jan 27 07:59:06 2017 New Revision: 244962 URL: https://gcc.gnu.org/viewcvs?rev=244962=gcc=rev Log: Fix PR c++/64382 PR c++/64382 * cp/parser.c (parsing_default_capturing_generic_lambda_in_template): New function. * cp/cp-tree.h: Declare it. * cp/semantics.c (finish_id_expression): Resolve names within a default capturing generic lambda defined within a template prior to instantiation to allow for captures to be added to the closure type. PR c++/64382 * g++.dg/cpp1y/pr64382.C: New test. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr64382.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-tree.h trunk/gcc/cp/parser.c trunk/gcc/cp/semantics.c trunk/gcc/testsuite/ChangeLog
[Bug c++/64382] ICE due to use of `this` inside a lambda that captures everything by ref inside a member function of a class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64382 Adam Butcher changed: What|Removed |Added Status|RESOLVED|ASSIGNED Resolution|DUPLICATE |--- Target Milestone|--- |7.0 --- Comment #6 from Adam Butcher --- Reopened and unmarked as dup of 61636. At the time the backtrace was the same and I submitted a patch series solving both. Since Nathan's fix for 61636 has since been accepted and pushed, this one needs an additional change. My original April 2015 patch still applies for this but I will resubmit to gcc-patches against latest master.
[Bug c++/61636] generic lambda: segfault / "cannot call member function without object"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61636 --- Comment #26 from Adam Butcher --- (In reply to Nathan Sidwell from comment #25) > Fixed. We capture this if we find at least one non-static member function. > This agrees with Clang's implementation, after discussion with Richard Smith. > Nice. Your [much cleaner] patch sorts out the starred case above too. With GCC master (7.0.0 20170119) with your patch the results are: auto l0 = [&](auto z) { f (z); };// C:8 G:1 G':8 G'':8 auto l1 = [&](auto) { f (2.4); };// C:8 G:1 G':8 G'':1 * fixed :) auto l2 = [&](auto) { O::x (2.4); }; // C:8 G:1 G':1 G'':1 auto l3 = [&](auto) { N::y (2.4); }; // C:1 G:1 G':1 G'':1 auto l4 = [&](auto) { }; // C:1 G:1 G':1 G'':1 auto l5 = [&](int z) { f (z); }; // C:8 G:8 G':8 G'':8 auto l6 = [&](int) { f (2.4); }; // C:8 G:1 G':1 G'':1 auto l7 = [&](int) { O::x (2.4); }; // C:8 G:1 G':1 G'':1 auto l8 = [&](int) { N::y (2.4); }; // C:1 G:1 G':1 G'':1 auto l9 = [&](int) { }; // C:1 G:1 G':1 G'':1 with closure sizes indicated for C = Clang RELEASE_391/final, G = GCC prior to fix, G' = GCC with my old patch, G'' = latest GCC with your patch. It's interesting you reference Clang's implementation though as, judging by the results of the above test, Clang is capturing 'this' far more often than it should be; even in cases where a enclosed class member is not referenced at all (in extreme cases the referenced fn is a static member function of a completely different class). And even stranger, Clang appears to behave the same for monomorphic lambdas too. Not sure what's going on there.
[Bug c++/77914] Wrong lambda definition accepted
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77914 --- Comment #4 from Adam Butcher --- (In reply to Michele Caini from comment #3) > (In reply to Jakub Jelinek from comment #1) > > Shall we remove that altogether, or just pedwarn on it? > > I suspect it should be rejected, unless it is an intended extension of the > compiler (for which I've not been able to find the docs - in this case, a > pedwarn should be emitted at least). It was an intended extension. Without it, a lambda argument cannot include a non-type template parameter or name within its body (without decltype) a type inferred from its arguments. Since it does not conflict with the standard, it should be acceptable as a GCC extension. I didn't document it at the time, however, or pedwarn about it. Possibly at the time it was added the standard was still being finalized. We could leave this issue open to address the docs and pedwarn unless you want to drop the feature completely?
[Bug c++/61636] generic lambda: segfault / "cannot call member function without object"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61636 Adam Butcher changed: What|Removed |Added Assignee|abutcher at gcc dot gnu.org|unassigned at gcc dot gnu.org --- Comment #22 from Adam Butcher --- Firstly, apologies for not unassigning myself from this; I hope it hasn't stopped others from looking into it. I had meant to unassign myself after my last attempt to fix this in early 2015. Since then I haven't had any spare time to look into it. The patch I submitted in 2015 (https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00617.html) does indeed solve this. However, it captures 'this' in generic lambdas in some cases where it is not required. This is not ideal (see the follow up list discussion starting from Jason's review https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00934.html). The current implementation, though non-optimal, may be preferable to waiting for a better version as at least code can be written which is correct, minimal and doesn't surprise users (i.e. no 'this->' workarounds required). This bug could be closed in favor of a "'this' is captured in generic lambdas when it is not necessary'" with proofs along the lines as I suggested in https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00959.html and https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00973.html. I've just done some 'this' capture analysis using Clang (3.9.0), the current stock ArchLinux GCC (6.2.1 20160830) and my own build of GCC (7.0.0 20161215) including the patches above. Clang stops short of a fully optimal solution. In fact it is less optimal than GCC even for monomorphic lambdas. It seems to capture 'this' whenever it sees a name within the lambda body that resolves to a member, whether or not that reference requires 'this'. It even captures 'this' when a reference is made to static member of a _different_ class which is surprising. The following show a handful of cases. The comments inline indicate whether 'this' is captured (sizeof lambda == 8) or not captured (sizeof lambda == 1) for Clang (C), GCC (G) and GCC with my 2015 patches (G'). The line tagged with the asterisk is the only case in this set where the patch is non-optimal; "f (2.4)" unambiguously resolves to the static member "A::f", so 'this' need not be captured. Since, with the patch, GCC is correct and more optimal than Clang, I think it would make sense to go with it and raise a separate ticket to address the other issue. struct A { void b (); void f (int); static void f (double); }; struct O { void x (int); static void x (double); }; namespace N { void y (double); } template struct diag; void A::b() { auto l0 = [&](auto z) { f (z); };diag {}; // C:8 G:1 G':8 auto l1 = [&](auto) { f (2.4); };diag {}; // C:8 G:1 G':8 * auto l2 = [&](auto) { O::x (2.4); }; diag {}; // C:8 G:1 G':1 auto l3 = [&](auto) { N::y (2.4); }; diag {}; // C:1 G:1 G':1 auto l4 = [&](auto) { }; diag {}; // C:1 G:1 G':1 auto l5 = [&](int z) { f (z); }; diag {}; // C:8 G:8 G':8 auto l6 = [&](int) { f (2.4); }; diag {}; // C:8 G:1 G':1 auto l7 = [&](int) { O::x (2.4); }; diag {}; // C:8 G:1 G':1 auto l8 = [&](int) { N::y (2.4); }; diag {}; // C:1 G:1 G':1 auto l9 = [&](int) { }; diag {}; // C:1 G:1 G':1 }
[Bug c++/69139] [4.9/5/6 Regression] deduction failure with trailing return type in function template argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69139 --- Comment #5 from Adam Butcher --- The patch at https://gcc.gnu.org/ml/gcc-patches/2016-02/msg00561.html adds handling for cv/ref mentioned by TC in #c3. I've added handling of tx and exception specs to.
[Bug c++/69139] [4.9/5/6 Regression] deduction failure with trailing return type in function template argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69139 --- Comment #4 from Adam Butcher --- @TC: Good call. The patch at https://gcc.gnu.org/ml/gcc-patches/2016-02/msg00495.html doesn't handle cv/ref qualifiers. I've expanded the testcase locally and will fix up the look-ahead solution to handle them.
[Bug c++/69139] [4.9/5/6 Regression] deduction failure with trailing return type in function template argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69139 Adam Butcher changed: What|Removed |Added Assignee|abutcher at gcc dot gnu.org|unassigned at gcc dot gnu.org --- Comment #6 from Adam Butcher --- Patrick's solution with arbitrary lookahead (https://gcc.gnu.org/ml/gcc-patches/2016-02/msg00595.html) looks better for this.
[Bug c++/65750] [4.9/5 Regression] misinterpret in a virtual member function with a C++11 style function signature
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65750 --- Comment #5 from Adam Butcher abutcher at gcc dot gnu.org --- This lookahead sketch (https://gcc.gnu.org/ml/gcc-patches/2015-04/msg00712.html) appears to work but I've don't limited testing.
[Bug c++/65750] [4.9/5 Regression] misinterpret in a virtual member function with a C++11 style function signature
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65750 --- Comment #3 from Adam Butcher abutcher at gcc dot gnu.org --- Agreed. Upon seeing the 'auto' in the parameter list, we'll synthesize a template parameter for 'g'. I think Paolo added the diagnostic for virtual to fix an ICE. I'm not sure immediately how to handle this one. For function pointer types auto ( should have this behavior. Maybe we need a bit of look-ahead to solve this (either for a function pointer or the trailing return arrow). Looks like trying to tie down semantics at parse time is biting us again.
[Bug c++/64382] ICE due to use of `this` inside a lambda that captures everything by ref inside a member function of a class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64382 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |abutcher at gcc dot gnu.org --- Comment #5 from Adam Butcher abutcher at gcc dot gnu.org --- Patch submitted to gcc-patches along with pr61636.
[Bug c++/64382] ICE due to use of `this` inside a lambda that captures everything by ref inside a member function of a class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64382 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |DUPLICATE --- Comment #4 from Adam Butcher abutcher at gcc dot gnu.org --- Marking as dup of 61636. *** This bug has been marked as a duplicate of bug 61636 ***
[Bug c++/61636] generic lambda cannot call member function without object
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61636 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added CC||lh_mouse at 126 dot com --- Comment #11 from Adam Butcher abutcher at gcc dot gnu.org --- *** Bug 64382 has been marked as a duplicate of this bug. ***
[Bug c++/61636] generic lambda cannot call member function without object
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61636 --- Comment #12 from Adam Butcher abutcher at gcc dot gnu.org --- If the containing context is made a template (as per pr64382 and pr64466) or if the patch below is made to lambda.c, the synthesized default 'this' looks to get captured OK, but gimplification process crashes. The start looks promising. From gimplify_return_expr: return D.2190 = X::f (__closure-__this, x) through gimplify_call_expr: X::f (__closure-__this, x) but the gimplification of the subject argument __closure-__this crashes due to component_ref_field_offset returning NULL for it. I'm thinking the 'this' reference built with build_x_indirect_ref in maybe_resolve_dummy may need some extra bolstering in the generic lambda case. Another point maybe worthy of note: If a non-static, non-function member is referenced within the generic lambda, it causes 'this' to be default captured correctly (as it does when explicitly specifying this-) and the compilation completes as expected. --- Patch to default capture 'this' in generic lambdas --- @@ -781,21 +797,38 @@ maybe_resolve_dummy (tree object, bool add_capture_p) tree type = TYPE_MAIN_VARIANT (TREE_TYPE (object)); gcc_assert (!TYPE_PTR_P (type)); - if (type != current_class_type - current_class_type - LAMBDA_TYPE_P (current_class_type) - lambda_function (current_class_type) - DERIVED_FROM_P (type, current_nonlambda_class_type ())) + if (type == current_class_type) +return object; + + tree lambda = ((current_class_type LAMBDA_TYPE_P (current_class_type))? +lambda_function (current_class_type) : 0); + if (lambda + (DERIVED_FROM_P (type, current_nonlambda_class_type ()) + || (DECL_TEMPLATE_INFO (lambda) + DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (lambda)) == lambda))) { /* In a lambda, need to go through 'this' capture. */ tree lam = CLASSTYPE_LAMBDA_EXPR (current_class_type); tree cap = lambda_expr_this_capture (lam, add_capture_p); ---
[Bug c++/64382] ICE due to use of `this` inside a lambda that captures everything by ref inside a member function of a class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64382 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added CC||abutcher at gcc dot gnu.org --- Comment #3 from Adam Butcher abutcher at gcc dot gnu.org --- This looks like a dup of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61636 Explicitly specifying 'this-' in the call to 'push' works around it. I get the same backtrace for this bug as I do in my work tree for the repro of 61636: gcc/testsuite/g++.dg/cpp1y/pr64382.C|10 col 11| internal compiler error: Segmentation fault ||push(v); ||^ || 0xcc3e9f crash_signal || ../../gcc/toplev.c:383 || 0xa0ad38 contains_struct_check || ../../gcc/tree.h:2959 || 0xa0ad38 size_binop_loc(unsigned int, tree_code, tree_node*, tree_node*) || ../../gcc/fold-const.c:1755 || 0xacdcd9 gimplify_compound_lval || ../../gcc/gimplify.c:2035 component_ref_for_field_offset (t) (where t is '__closure-__this') is returning NULL for some reason. Haven't tracked down why yet.
[Bug c++/61636] generic lambda cannot call member function without object
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61636 --- Comment #8 from Adam Butcher abutcher at gcc dot gnu.org --- (In reply to tower120 from comment #7) I'm not sure what you mean, about adding this-. I meant spelling fn1(data) as this-fn1(data) to explicitly specify the subject of the member call. But this case is not working : http://coliru.stacked-crooked.com/a/d69de477f9a746cb But to be true, it not work with clang either. In the case you link to, specifically within the member function template 'go', std::cout if_elsedo_it( []{ return this-fn1(data); }, []{ return this-fn2(data); } ) '\n'; you are building up two non-generic (non-template) lambdas that are not dependent on any template parameter. The if_else is, but the two arguments are not. Both have to be evaluated to pass to the if_else. Because they are not templates, the body of both lambdas must be well formed within 'go'. 'fn1' and 'fn2' are both being passed 'data' which is either of type 'A' or of type 'B'. There are no overloads of 'fn1' that can accept a 'B'. That's what both clang and g++ are getting at in their diagnostics. The fact that g++ proceeds to ICE on recovery is another issue.
[Bug c++/61636] generic lambda cannot call member function without object
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61636 --- Comment #9 from Adam Butcher abutcher at gcc dot gnu.org --- (In reply to Adam Butcher from comment #8) There are no overloads of 'fn1' that can accept a 'B'. Oops, sorry. I meant to say that there are no overloads of 'fn1' that can accept an 'A'. Clearly a 'B' may be used as an 'A' but not vice versa.
[Bug c++/61636] generic lambda cannot call member function without object
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61636 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added CC|adam at jessamine dot co.uk|abutcher at gcc dot gnu.org --- Comment #4 from Adam Butcher abutcher at gcc dot gnu.org --- (In reply to tower120 from comment #0) std::cout if_else(do_first, data, [](auto /*B*/ data){ std::cout std::endl; std::cout std::is_samedecltype(data), B::value; std::cout std::endl; return fn1(/*static_castB*/(data)); }, [](A data){ return fn2(data); } ); } }; This works if this- is used to explicitly specify the object upon which to call 'fn1'. It works whether or not the static_cast is present or whether auto or B is is used. It looks like a binding issue with lambda templates; the name 'fn1' is being seen as a reference to the member function rather than an attempt to bind it to the captured 'this' for a member call. The fact that clang compiles it fine makes me think that this is indeed a genuine bug and that the extra this- qualification is not required by the language. In dependent base member access, an explicit this- is required, but I don't think it should be necessary here. I'll have a look into it; but I've limited time to do so at the mo.
[Bug c++/61636] generic lambda cannot call member function without object
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61636 --- Comment #5 from Adam Butcher abutcher at gcc dot gnu.org --- In an attempt to get a reduced testcase, I've uncovered an ICE. With the extra this- qualification on the reference to 'f' below, the code compiles fine. Alternatively, if 'this' is explicitly captured, the unqualified member call works too. There is clearly something a bit odd going on in this area. struct X { template typename T void f(T t) {} template typename T void g(T t) { [] (auto x) { f(x); } (t); } }; int main() { X x; x.g(2); } :10:10: internal compiler error: Segmentation fault f(x); ^ 0xb8926f crash_signal ../../gcc/toplev.c:337 0x95afe8 contains_struct_check ../../gcc/tree.h:2840 0x95afe8 size_binop_loc(unsigned int, tree_code, tree_node*, tree_node*) ../../gcc/fold-const.c:1471 0x9d0f49 gimplify_compound_lval ../../gcc/gimplify.c:1998 0x9c89ae gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc/gimplify.c:7618 0x9d2808 gimplify_call_expr ../../gcc/gimplify.c:2432 0x9c8b37 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc/gimplify.c:7637 0x9cd306 gimplify_stmt(tree_node**, gimple_statement_base**) ../../gcc/gimplify.c:5417 0x9c8bc2 gimplify_cleanup_point_expr ../../gcc/gimplify.c:5193 0x9c8bc2 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc/gimplify.c:8029 0x9cd306 gimplify_stmt(tree_node**, gimple_statement_base**) ../../gcc/gimplify.c:5417 0x9ce1af gimplify_bind_expr ../../gcc/gimplify.c:1100 0x9c907e gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_base**, bool (*)(tree_node*), int) ../../gcc/gimplify.c:7863 0x9cd306 gimplify_stmt(tree_node**, gimple_statement_base**) ../../gcc/gimplify.c:5417 0x9cec36 gimplify_body(tree_node*, bool) ../../gcc/gimplify.c:8773 0x9cf236 gimplify_function_tree(tree_node*) ../../gcc/gimplify.c:8926 0x84d117 analyze_function ../../gcc/cgraphunit.c:650 0x84e3bb analyze_functions ../../gcc/cgraphunit.c:1028 0x84fc45 finalize_compilation_unit() ../../gcc/cgraphunit.c:2333 0x63bece cp_write_global_declarations() ../../gcc/cp/decl2.c:4647
[Bug c++/61636] generic lambda cannot call member function without object
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61636 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2014-07-06 Assignee|unassigned at gcc dot gnu.org |abutcher at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #6 from Adam Butcher abutcher at gcc dot gnu.org --- Reduced testcase: struct X { template typename T void f(T t) {} auto defer_f() { return [] (auto x) { f(x); }; } }; int main() { X x; x.defer_f()(2); } Compiles if this-f(x) is used within 'defer_f'.
[Bug c++/61537] [4.9/4.10 Regression] template parameter lists wrongly detected on struct or class keyword on parameters
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61537 --- Comment #9 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Thu Jun 26 18:33:57 2014 New Revision: 212045 URL: https://gcc.gnu.org/viewcvs?rev=212045root=gccview=rev Log: Fix PR c++/61537 * parser.c (cp_parser_elaborated_type_specifier): Only consider template parameter lists outside of function parameter scope. * g++.dg/template/pr61537.C: New testcase. Added: branches/gcc-4_9-branch/gcc/testsuite/g++.dg/template/pr61537.C Modified: branches/gcc-4_9-branch/gcc/cp/ChangeLog branches/gcc-4_9-branch/gcc/cp/parser.c branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
[Bug c++/61537] [4.9/4.10 Regression] template parameter lists wrongly detected on struct or class keyword on parameters
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61537 --- Comment #10 from Adam Butcher abutcher at gcc dot gnu.org --- Fixed in 4.9.1
[Bug c++/61537] [4.9/4.10 Regression] template parameter lists wrongly detected on struct or class keyword on parameters
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61537 --- Comment #7 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Thu Jun 26 05:12:52 2014 New Revision: 212008 URL: https://gcc.gnu.org/viewcvs?rev=212008root=gccview=rev Log: Fix PR c++/61537 * parser.c (cp_parser_elaborated_type_specifier): Only consider template parameter lists outside of function parameter scope. * g++.dg/template/pr61537.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/template/pr61537.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/61537] [4.9/4.10 Regression] template parameter lists wrongly detected on struct or class keyword on parameters
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61537 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #8 from Adam Butcher abutcher at gcc dot gnu.org --- Fixed in 4.10
[Bug c++/61537] [4.9/4.10 Regression] template parameter lists wrongly detected on struct or class keyword on parameters
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61537 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |abutcher at gcc dot gnu.org Target Milestone|--- |4.10.0 --- Comment #6 from Adam Butcher abutcher at gcc dot gnu.org --- I'll have a look...
[Bug c++/60626] [c++1y] ICE with pointer to function with auto parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60626 --- Comment #1 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Sat Mar 29 19:23:44 2014 New Revision: 208940 URL: http://gcc.gnu.org/viewcvs?rev=208940root=gccview=rev Log: Fix PR c++/60626 PR c++/60626 * parser.c (cp_parser_init_declarator): Handle erroneous generic type usage in non-functions with pushed scope. PR c++/60626 * g++.dg/cpp1y/pr60626.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr60626.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/60626] [c++1y] ICE with pointer to function with auto parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60626 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #2 from Adam Butcher abutcher at gcc dot gnu.org --- Fixed in 4.9.
[Bug c++/60573] [c++1y] ICE with defining generic function of nested class in class scope
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60573 --- Comment #1 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Fri Mar 28 20:41:45 2014 New Revision: 208921 URL: http://gcc.gnu.org/viewcvs?rev=208921root=gccview=rev Log: Fix PR c++/60573 PR c++/60573 * name-lookup.h (cp_binding_level): New transient field defining_class_p to indicate whether a scope is in the process of defining a class. * semantics.c (begin_class_definition): Set defining_class_p. * name-lookup.c (leave_scope): Reset defining_class_p. * parser.c (synthesize_implicit_template_parm): Use cp_binding_level:: defining_class_p rather than TYPE_BEING_DEFINED as the predicate for unwinding to class-defining scope to handle the erroneous definition of a generic function of an arbitrarily nested class within an enclosing class. PR c++/60573 * g++.dg/cpp1y/pr60573.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr60573.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/name-lookup.c trunk/gcc/cp/name-lookup.h trunk/gcc/cp/parser.c trunk/gcc/cp/semantics.c trunk/gcc/testsuite/ChangeLog
[Bug c++/60573] [c++1y] ICE with defining generic function of nested class in class scope
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60573 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #2 from Adam Butcher abutcher at gcc dot gnu.org --- Fixed in 4.9.
[Bug c++/60627] [c++1y] ICE in explicit template instantiation containing auto parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60627 --- Comment #1 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Mon Mar 24 20:40:15 2014 New Revision: 208799 URL: http://gcc.gnu.org/viewcvs?rev=208799root=gccview=rev Log: Fix PR c++/60627 PR c++/60627 * parser.c (cp_parser_parameter_declaration_clause): Prevent 'auto' from introducing an implicit function template parameter within an explicit instantiation. PR c++/60627 * g++.dg/cpp1y/pr60627.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr60627.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/60627] [c++1y] ICE in explicit template instantiation containing auto parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60627 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED Assignee|unassigned at gcc dot gnu.org |abutcher at gcc dot gnu.org Target Milestone|--- |4.9.0 --- Comment #2 from Adam Butcher abutcher at gcc dot gnu.org --- Fixed in 4.9.
[Bug c++/60626] [c++1y] ICE with pointer to function with auto parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60626 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Last reconfirmed||2014-03-23 Assignee|unassigned at gcc dot gnu.org |abutcher at gcc dot gnu.org Target Milestone|--- |4.9.0
[Bug c++/60626] [c++1y] ICE with pointer to function with auto parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60626 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed|2014-03-23 00:00:00 |2014-03-24 Ever confirmed|0 |1
[Bug c++/60573] [c++1y] ICE with defining generic function of nested class in class scope
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60573 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2014-03-19 Assignee|unassigned at gcc dot gnu.org |abutcher at gcc dot gnu.org Target Milestone|--- |4.9.0 Ever confirmed|0 |1
[Bug c++/60390] [c++1y] ICE with declaring function with auto parameter as friend
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60390 --- Comment #1 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Mon Mar 17 20:02:26 2014 New Revision: 208625 URL: http://gcc.gnu.org/viewcvs?rev=208625root=gccview=rev Log: Fix PR c++/60390 PR c++/60390 * parser.c (cp_parser_member_declaration): Don't allow finish_fully_implicit_template to consider friend declarations to be class member templates. (synthesize_implicit_template_parm): Handling winding back through class scope to the class being defined in order to inject a template argument list. PR c++/60390 * g++.dg/cpp1y/pr60390.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr60390.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/60391] [c++1y] ICE with auto parameter for operator
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60391 --- Comment #1 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Mon Mar 17 20:02:16 2014 New Revision: 208624 URL: http://gcc.gnu.org/viewcvs?rev=208624root=gccview=rev Log: Fix PR c++/60391 PR c++/60391 * parser.c (cp_parser_skip_to_end_of_block_or_statement): Unwind generic function scope as per cp_parser_skip_to_end_of_statement. PR c++/60391 * g++.dg/cpp1y/pr60391.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr60391.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/60391] [c++1y] ICE with auto parameter for operator
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60391 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #2 from Adam Butcher abutcher at gcc dot gnu.org --- Fixed in 4.9.
[Bug c++/60390] [c++1y] ICE with declaring function with auto parameter as friend
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60390 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #2 from Adam Butcher abutcher at gcc dot gnu.org --- Fixed in 4.9.
[Bug c++/60391] [c++1y] ICE with auto parameter for operator
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60391 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |abutcher at gcc dot gnu.org Target Milestone|--- |4.9.0
[Bug c++/60391] [c++1y] ICE with auto parameter for operator
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60391 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2014-03-15 Ever confirmed|0 |1
[Bug c++/60390] [c++1y] ICE with declaring function with auto parameter as friend
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60390 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2014-03-15 Assignee|unassigned at gcc dot gnu.org |abutcher at gcc dot gnu.org Target Milestone|--- |4.9.0 Ever confirmed|0 |1
[Bug c++/60393] [c++1y] ICE with with invalid functions with auto parameters
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60393 --- Comment #1 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Sat Mar 8 09:33:03 2014 New Revision: 208426 URL: http://gcc.gnu.org/viewcvs?rev=208426root=gccview=rev Log: Fix PR c++/60393 PR c++/60393 * parser.c (cp_parser_parameter_declaration_clause): Move generic function template unwinding on error into a more general location, ... (cp_parser_skip_to_end_of_statement): ... here. PR c++/60393 * g++.dg/cpp1y/pr60393.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr60393.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/60033] [c++1y] ICE in retrieve_specialization while compiling recursive generic lambda
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60033 --- Comment #8 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Sat Mar 8 09:33:12 2014 New Revision: 208427 URL: http://gcc.gnu.org/viewcvs?rev=208427root=gccview=rev Log: Fix PR c++/60033 PR c++/60033 * pt.c (tsubst_copy): When retrieving a capture pack from a generic lambda, remove the lambda's own template argument list prior to fetching the specialization. PR c++/60033 * g++.dg/cpp1y/pr60033.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr60033.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog
[Bug c++/60033] [c++1y] ICE in retrieve_specialization while compiling recursive generic lambda
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60033 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED Assignee|unassigned at gcc dot gnu.org |abutcher at gcc dot gnu.org Target Milestone|--- |4.9.0 --- Comment #9 from Adam Butcher abutcher at gcc dot gnu.org --- Fixed in 4.9.
[Bug c++/60393] [c++1y] ICE with with invalid functions with auto parameters
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60393 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED Assignee|unassigned at gcc dot gnu.org |abutcher at gcc dot gnu.org Target Milestone|--- |4.9.0 --- Comment #2 from Adam Butcher abutcher at gcc dot gnu.org --- Fixed in 4.9.
[Bug c++/60033] [c++1y] ICE in retrieve_specialization while compiling recursive generic lambda
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60033 --- Comment #6 from Adam Butcher abutcher at gcc dot gnu.org --- A further reduced testcase: // PR c++/60033 // { dg-options -std=c++1y } template typename... T auto f(T... ts) { return sizeof...(ts); } template typename... T auto g(T... ts) { return [] (int v) { return f(ts...); }; } int main() { return g(1,2,3,4)(5) == 4 ? 0 : 1; }
[Bug c++/60033] [c++1y] ICE in retrieve_specialization while compiling recursive generic lambda
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60033 --- Comment #7 from Adam Butcher abutcher at gcc dot gnu.org --- (In reply to Adam Butcher from comment #6) return [] (int v) { return f(ts...); }; Should have been: return [] (auto v) { return f(ts...); }; The 'int' version works as expected.
[Bug c++/60377] [c++1y] ICE with invalid function parameter in conjunction with auto parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60377 --- Comment #1 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Sat Mar 1 21:28:18 2014 New Revision: 208250 URL: http://gcc.gnu.org/viewcvs?rev=208250root=gccview=rev Log: Fix PR c++/60377. PR c++/60377 * parser.c (cp_parser_parameter_declaration_clause): Unwind generic function scope on parse error in function parameter list. PR c++/60377 * g++.dg/cpp1y/pr60377.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr60377.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/60312] [4.9 Regression] [c++1y] ICE using auto as template parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60312 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added CC||abutcher at gcc dot gnu.org --- Comment #3 from Adam Butcher abutcher at gcc dot gnu.org --- I think this might have fixed PR c++/60311 too.
[Bug c++/60312] [4.9 Regression] [c++1y] ICE using auto as template parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60312 --- Comment #5 from Adam Butcher abutcher at gcc dot gnu.org --- Actually strike that, my [local] changes relating to PR c++/60065 (http://gcc.gnu.org/ml/gcc-patches/2014-02/msg01437.html) seem to have changed the behavior.
[Bug c++/60065] [c++1y] ICE with auto parameter pack
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60065 --- Comment #3 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Tue Feb 25 03:47:24 2014 New Revision: 208106 URL: http://gcc.gnu.org/viewcvs?rev=208106root=gccview=rev Log: Fix PR c++/60065. PR c++/60065 * parser.c (cp_parser_direct_declarator): Don't save and restore num_template_parameter_lists around call to cp_parser_parameter_declaration_list. (function_being_declared_is_template_p): New predicate. (cp_parser_parameter_declaration_list): Use function_being_declared_is_template_p as predicate for inspecting current function template parameter list length rather than num_template_parameter_lists. PR c++/60065 * g++.dg/cpp1y/pr60065.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr60065.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/60311] [c++1y] ICE with pointer-to-function with auto parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60311 --- Comment #1 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Tue Feb 25 06:44:53 2014 New Revision: 208111 URL: http://gcc.gnu.org/viewcvs?rev=208111root=gccview=rev Log: Fix PR c++/60311. PR c++/60311 * parser.c (function_being_declared_is_template_p): Return false when processing a template parameter list. (cp_parser_parameter_declaration_clause): Don't set auto_is_implicit_function_template_parm_p when processing a template parameter list. PR c++/60311 * g++.dg/cpp1y/pr60311.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr60311.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/60053] [c++1y] ICE with auto as member template function parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60053 --- Comment #1 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Fri Feb 21 07:47:55 2014 New Revision: 207980 URL: http://gcc.gnu.org/viewcvs?rev=207980root=gccview=rev Log: Fix PR c++/60052 and PR c++/60053. PR c++/60052 PR c++/60053 * parser.c (cp_parser_parameter_declaration_list): Correctly reset implicit_template_scope upon leaving an out-of-line generic member function definition. PR c++/60052 PR c++/60053 * g++.dg/cpp1y/pr60052.C: New testcase. * g++.dg/cpp1y/pr60053.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr60052.C trunk/gcc/testsuite/g++.dg/cpp1y/pr60053.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/60052] [c++1y] ICE with auto as member function parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60052 --- Comment #1 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Fri Feb 21 07:47:55 2014 New Revision: 207980 URL: http://gcc.gnu.org/viewcvs?rev=207980root=gccview=rev Log: Fix PR c++/60052 and PR c++/60053. PR c++/60052 PR c++/60053 * parser.c (cp_parser_parameter_declaration_list): Correctly reset implicit_template_scope upon leaving an out-of-line generic member function definition. PR c++/60052 PR c++/60053 * g++.dg/cpp1y/pr60052.C: New testcase. * g++.dg/cpp1y/pr60053.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr60052.C trunk/gcc/testsuite/g++.dg/cpp1y/pr60053.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/60065] [c++1y] ICE with auto parameter pack
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60065 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added CC||abutcher at gcc dot gnu.org --- Comment #1 from Adam Butcher abutcher at gcc dot gnu.org --- I think it is valid. It should be considered equivalent to: template int, typename... T void foo(T... x); Looks like the generic parameter pack 'auto...' is replacing the template argument list rather than extending it. I'll look into it.
[Bug c++/60065] [c++1y] ICE with auto parameter pack
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60065 --- Comment #2 from Adam Butcher abutcher at gcc dot gnu.org --- Turns out the base template parameter index was not been initialized correctly so it was trying to convert the 'int' parameter to a pack as well as the invented template parameter generated for the 'auto'. See http://gcc.gnu.org/ml/gcc-patches/2014-02/msg01197.html
[Bug c++/60190] [c++1y] ICE with invalid return type of template lambda
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60190 --- Comment #4 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Tue Feb 18 21:07:48 2014 New Revision: 207852 URL: http://gcc.gnu.org/viewcvs?rev=207852root=gccview=rev Log: Fix PR c++/60190. PR c++/60190 * parser.c (cp_parser_lambda_declarator_opt): Pop template parameter scope whenever a template parameter list has been started, independent of whether the function call operator was well-formed or not. PR c++/60190 * g++.dg/cpp1y/pr60190.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr60190.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/60064] [c++1y] ICE with auto as parameter of friend function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60064 --- Comment #2 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Tue Feb 18 22:29:56 2014 New Revision: 207856 URL: http://gcc.gnu.org/viewcvs?rev=207856root=gccview=rev Log: Fix PR c++/60064. PR c++/60064 * parser.c (cp_parser_member_declaration): Pop fully implicit template scope for generic friend declarations as well as for non-friends. PR c++/60064 * g++.dg/cpp1y/pr60064.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr60064.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/60033] ICE in retrieve_specialization while compiling recursive generic lambda
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60033 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added CC||abutcher at gcc dot gnu.org --- Comment #3 from Adam Butcher abutcher at gcc dot gnu.org --- The following reduced test case gives the same ICE: --- #include utility template typename Func auto compose(Func f) { return f; } template typename Func, typename... Funcs auto compose(Func f, Funcs... fs) { return [] (auto v) { return f(compose(std::forwardFuncs(fs)...)(v)); }; } int main() { float v = 3.5f; auto func = [] (auto v) { return int(v-0.5); }; auto t = compose([] (auto v) { return v = 3; }, func)(v); auto f = compose([] (auto v) { return v 3; }, func)(v); return (t == true f == false)? 0 : 1; } --- 'retrieve_specialization' is failing an assertion due to a mismatch between the template argument depth and template decl depth when considering the pack expansion of the captured 'fs' within the generic lambda: --- || args = tree_vec 0x7ffd49d54ed8 || elt 0 tree_vec 0x7ffd49d54eb0 || elt 0 record_type 0x7ffd49d48c78 __lambda2 needs-constructing type_5 type_6 QI || size integer_cst 0x7ffd49df1280 constant 8 || unit size integer_cst 0x7ffd49df12a0 constant 1 || align 8 symtab 0 alias set -1 canonical type 0x7ffd49d48c78 fields type_decl 0x7ffd49d41b80 __lambda2 context function_decl 0x7ffd49d2bc00 main || full-name struct main()::lambda(auto:3) || needs-constructor X() has-type-conversion X(constX) this=(X) n_parents=0 use_template=0 interface-unknown || pointer_to_this pointer_type 0x7ffd49d4b9d8 reference_to_this reference_type 0x7ffd49d510a8 chain type_decl 0x7ffd49d41ac8 __lambda2 || elt 1 type_argument_pack 0x7ffd49d56a80 || type tree_vec 0x7ffd49d53a20 elt 0 reference_type 0x7ffd49d48930 || VOID || align 8 symtab 0 alias set -1 canonical type 0x7ffd49d56a80 || elt 1 tree_vec 0x7ffd49d53a40 || elt 0 real_type 0x7ffd49e02348 float type_6 SF || size integer_cst 0x7ffd49df1440 constant 32 || unit size integer_cst 0x7ffd49df1460 constant 4 || align 32 symtab 0 alias set -1 canonical type 0x7ffd49e02348 precision 32 || pointer_to_this pointer_type 0x7ffd49e02540 || tmpl = field_decl 0x7ffd49d34ab0 __fs || type type_pack_expansion 0x7ffd49d450a8 || type reference_type 0x7ffd49d45000 type decltype_type 0x7ffd49d40f18 || unsigned DI || size integer_cst 0x7ffd49df10c0 constant 64 || unit size integer_cst 0x7ffd49df10e0 constant 8 || align 64 symtab 0 alias set -1 structural equality || tree_0 VOID || align 8 symtab 0 alias set -1 structural equality || used decl_7 VOID file gcc/testsuite/g++.dg/cpp1y/pr60033.C line 15 col 42 || align 1 offset_align 1 context record_type 0x7ffd49d4 __lambda0 chain type_decl 0x7ffd49d410b8 __lambda0 || TMPL_ARGS_DEPTH (args) = 2 || TREE_CODE (tmpl) == TEMPLATE_DECL = 0 || template_class_depth (DECL_CONTEXT (tmpl)) = 1 ---
[Bug c++/60033] ICE in retrieve_specialization while compiling recursive generic lambda
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60033 Adam Butcher abutcher at gcc dot gnu.org changed: What|Removed |Added CC||jason at gcc dot gnu.org --- Comment #4 from Adam Butcher abutcher at gcc dot gnu.org --- I think I have a fix for this but I need a sanity check. Does this adjustment in 'retrieve_specialization' look to be along the right lines Jason? Certainly the programs attached to this issue compile and run as expected; haven't gone any further than that though. /* When retrieving a capture pack from a generic lambda, remove the lambda call op's own template argument list from ARGS. Only the template arguments active for the closure type should be used to retrieve the pack specialization. */ if (TREE_CODE (tmpl) == FIELD_DECL LAMBDA_FUNCTION_P (current_function_decl) DECL_TEMPLATE_INFO (current_function_decl)) args = strip_innermost_template_args (args, 1);
[Bug c++/60033] ICE in retrieve_specialization while compiling recursive generic lambda
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60033 --- Comment #5 from Adam Butcher abutcher at gcc dot gnu.org --- Turns out that the above breaks the generic lambda variadic testcase: auto vglambda = [](auto printer) { return [=](auto ... ts) { // OK: ts is a function parameter pack printer(std::forwarddecltype(ts)(ts)...); return [=]() { printer(ts ...); }; }; }; So not there yet. Maybe using 'current_function' is wrong?
[Bug c++/59635] [c++1y] ICE with auto and ... as lambda parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59635 --- Comment #2 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Mon Jan 6 18:22:19 2014 New Revision: 206368 URL: http://gcc.gnu.org/viewcvs?rev=206368root=gccview=rev Log: Fix PR c++/59635 PR c++/59635 * cp/lambda.c (maybe_add_lambda_conv_op): Handle marking conversion function as unimplemented for generic lambdas with varargs. * g++.dg/cpp1y/pr59635.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr59635.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/lambda.c trunk/gcc/testsuite/ChangeLog
[Bug c++/59636] [c++1y] ICE with missing template parameter in lambda
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59636 --- Comment #2 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Mon Jan 6 18:22:29 2014 New Revision: 206369 URL: http://gcc.gnu.org/viewcvs?rev=206369root=gccview=rev Log: Fix PR c++/59636 PR c++/59636 * cp/parser.c (cp_parser_template_parameter): Early out with error_mark_node if parameter declaration was not parsed. * g++.dg/cpp1y/pr59636.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr59636.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/59629] [4.9 Regression] [c++11] ICE with invalid use of auto in lambda function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59629 --- Comment #1 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Mon Jan 6 18:22:38 2014 New Revision: 206370 URL: http://gcc.gnu.org/viewcvs?rev=206370root=gccview=rev Log: Fix PR c++/59629 PR c++/59629 * cp/parser.c (cp_parser_lambda_expression): Save/reset/restore auto_is_implicit_function_template_parm_p around lambda body. * g++.dg/cpp1y/pr59629.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr59629.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/59638] [c++1y] ICE with pointer to function that has auto as parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59638 --- Comment #3 from Adam Butcher abutcher at gcc dot gnu.org --- Author: abutcher Date: Mon Jan 6 18:22:48 2014 New Revision: 206371 URL: http://gcc.gnu.org/viewcvs?rev=206371root=gccview=rev Log: Fix PR c++/59638 PR c++/59638 * cp/parser.c (cp_parser_init_declarator): Undo fully implicit template parameter list when declarator is not a function. * g++.dg/cpp1y/pr59638.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr59638.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
[Bug c++/59113] [c++1y] ICE using auto as parameter in local function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59113 --- Comment #1 from abutcher at gcc dot gnu.org --- Author: abutcher Date: Mon Nov 25 07:43:55 2013 New Revision: 205343 URL: http://gcc.gnu.org/viewcvs?rev=205343root=gccview=rev Log: Disallow implicit function templates in local functions unless defining a lambda. gcc/cp/ PR c++/59112 PR c++/59113 * parser.c (cp_parser_parameter_declaration_clause): Disallow implicit function templates in local functions unless defining a lambda. gcc/testsuite/ PR c++/59112 PR c++/59113 g++.dg/cpp1y/pr58533.C: Updated testcase. g++.dg/cpp1y/pr59112.C: New testcase. g++.dg/cpp1y/pr59113.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr59112.C trunk/gcc/testsuite/g++.dg/cpp1y/pr59113.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/cpp1y/pr58533.C
[Bug c++/59112] [c++1y] ICE using auto as parameter in local class
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59112 --- Comment #1 from abutcher at gcc dot gnu.org --- Author: abutcher Date: Mon Nov 25 07:43:55 2013 New Revision: 205343 URL: http://gcc.gnu.org/viewcvs?rev=205343root=gccview=rev Log: Disallow implicit function templates in local functions unless defining a lambda. gcc/cp/ PR c++/59112 PR c++/59113 * parser.c (cp_parser_parameter_declaration_clause): Disallow implicit function templates in local functions unless defining a lambda. gcc/testsuite/ PR c++/59112 PR c++/59113 g++.dg/cpp1y/pr58533.C: Updated testcase. g++.dg/cpp1y/pr59112.C: New testcase. g++.dg/cpp1y/pr59113.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr59112.C trunk/gcc/testsuite/g++.dg/cpp1y/pr59113.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/cpp1y/pr58533.C
[Bug c++/58533] [c++1y] ICE with auto in function pointer
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58533 --- Comment #3 from abutcher at gcc dot gnu.org --- Author: abutcher Date: Thu Nov 14 08:26:21 2013 New Revision: 204776 URL: http://gcc.gnu.org/viewcvs?rev=204776root=gccview=rev Log: Added testcase for 58533, fixed by rev 204714. gcc/testsuite/ PR c++/58533 * g++.dg/cpp1y/pr58533.C: New testcase (fixed by r204714). Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr58533.C Modified: trunk/gcc/testsuite/ChangeLog
[Bug c++/58534] [c++1y] ICE with auto in template function parameters
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58534 --- Comment #1 from abutcher at gcc dot gnu.org --- Author: abutcher Date: Tue Nov 12 20:17:33 2013 New Revision: 204714 URL: http://gcc.gnu.org/viewcvs?rev=204714root=gccview=rev Log: Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637. gcc/ * tree.c (grow_tree_vec_stat): New function ... * tree.h (grow_tree_vec_stat) (grow_tree_vec): ... and its declaration and macro front-end. gcc/cp/ PR c++/58534 PR c++/58536 PR c++/58548 PR c++/58549 PR c++/58637 * parser.h (struct cp_parser): New members implicit_template_parms, implicit_template_scope and auto_is_implicit_function_template_parm_p. * parser.c (add_implicit_template_parms): Refactor as ... (synthesize_implicit_template_parm): ... this to append a new template type parm to the current template parameter list (introducing a new list if necessary). Removed push_deferring_access_checks. (finish_fully_implicit_template): Removed pop_deferring_access_checks. (cp_parser_new): Initialize new cp_parser members. (cp_parser_parameter_declaration_clause): Consider auto as implicit template parm when parsing a parameter declaration (unless parsing an explicit specialization). (cp_parser_parameter_declaration_list): Remove local implicit_template_parms counter and reset cp_parser implicit template state when complete. (cp_parser_lambda_expression): Reset implicit template cp_parser members whilst generating lambda class. (cp_parser_function_definition_after_declarator): Reset implicit template cp_parser members whilst parsing function definition. (make_generic_type_name): Respell 'autoN' as 'auto:N' which works better with template diagnostics. (cp_parser_simple_type_specifier): Synthesize implicit template parm on parsing 'auto' if auto_is_implicit_function_template_parm_p and provide diagnostics ... * decl.c (grokdeclarator): ... that were previously done here. gcc/testsuite/g++.dg/ * cpp1y/pr58534.C: New testcase. * cpp1y/pr58536.C: New testcase. * cpp1y/pr58548.C: New testcase. * cpp1y/pr58549.C: New testcase. * cpp1y/pr58637.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr58534.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58536.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58548.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58549.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58637.C Modified: trunk/gcc/ChangeLog trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/cp/parser.c trunk/gcc/cp/parser.h trunk/gcc/testsuite/ChangeLog trunk/gcc/tree.c trunk/gcc/tree.h
[Bug c++/58536] [c++1y] ICE with auto in constructor
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58536 --- Comment #3 from abutcher at gcc dot gnu.org --- Author: abutcher Date: Tue Nov 12 20:17:33 2013 New Revision: 204714 URL: http://gcc.gnu.org/viewcvs?rev=204714root=gccview=rev Log: Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637. gcc/ * tree.c (grow_tree_vec_stat): New function ... * tree.h (grow_tree_vec_stat) (grow_tree_vec): ... and its declaration and macro front-end. gcc/cp/ PR c++/58534 PR c++/58536 PR c++/58548 PR c++/58549 PR c++/58637 * parser.h (struct cp_parser): New members implicit_template_parms, implicit_template_scope and auto_is_implicit_function_template_parm_p. * parser.c (add_implicit_template_parms): Refactor as ... (synthesize_implicit_template_parm): ... this to append a new template type parm to the current template parameter list (introducing a new list if necessary). Removed push_deferring_access_checks. (finish_fully_implicit_template): Removed pop_deferring_access_checks. (cp_parser_new): Initialize new cp_parser members. (cp_parser_parameter_declaration_clause): Consider auto as implicit template parm when parsing a parameter declaration (unless parsing an explicit specialization). (cp_parser_parameter_declaration_list): Remove local implicit_template_parms counter and reset cp_parser implicit template state when complete. (cp_parser_lambda_expression): Reset implicit template cp_parser members whilst generating lambda class. (cp_parser_function_definition_after_declarator): Reset implicit template cp_parser members whilst parsing function definition. (make_generic_type_name): Respell 'autoN' as 'auto:N' which works better with template diagnostics. (cp_parser_simple_type_specifier): Synthesize implicit template parm on parsing 'auto' if auto_is_implicit_function_template_parm_p and provide diagnostics ... * decl.c (grokdeclarator): ... that were previously done here. gcc/testsuite/g++.dg/ * cpp1y/pr58534.C: New testcase. * cpp1y/pr58536.C: New testcase. * cpp1y/pr58548.C: New testcase. * cpp1y/pr58549.C: New testcase. * cpp1y/pr58637.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr58534.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58536.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58548.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58549.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58637.C Modified: trunk/gcc/ChangeLog trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/cp/parser.c trunk/gcc/cp/parser.h trunk/gcc/testsuite/ChangeLog trunk/gcc/tree.c trunk/gcc/tree.h
[Bug c++/58637] [c++1y] ICE with wrong usage of template in front of function containing auto parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58637 --- Comment #1 from abutcher at gcc dot gnu.org --- Author: abutcher Date: Tue Nov 12 20:17:33 2013 New Revision: 204714 URL: http://gcc.gnu.org/viewcvs?rev=204714root=gccview=rev Log: Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637. gcc/ * tree.c (grow_tree_vec_stat): New function ... * tree.h (grow_tree_vec_stat) (grow_tree_vec): ... and its declaration and macro front-end. gcc/cp/ PR c++/58534 PR c++/58536 PR c++/58548 PR c++/58549 PR c++/58637 * parser.h (struct cp_parser): New members implicit_template_parms, implicit_template_scope and auto_is_implicit_function_template_parm_p. * parser.c (add_implicit_template_parms): Refactor as ... (synthesize_implicit_template_parm): ... this to append a new template type parm to the current template parameter list (introducing a new list if necessary). Removed push_deferring_access_checks. (finish_fully_implicit_template): Removed pop_deferring_access_checks. (cp_parser_new): Initialize new cp_parser members. (cp_parser_parameter_declaration_clause): Consider auto as implicit template parm when parsing a parameter declaration (unless parsing an explicit specialization). (cp_parser_parameter_declaration_list): Remove local implicit_template_parms counter and reset cp_parser implicit template state when complete. (cp_parser_lambda_expression): Reset implicit template cp_parser members whilst generating lambda class. (cp_parser_function_definition_after_declarator): Reset implicit template cp_parser members whilst parsing function definition. (make_generic_type_name): Respell 'autoN' as 'auto:N' which works better with template diagnostics. (cp_parser_simple_type_specifier): Synthesize implicit template parm on parsing 'auto' if auto_is_implicit_function_template_parm_p and provide diagnostics ... * decl.c (grokdeclarator): ... that were previously done here. gcc/testsuite/g++.dg/ * cpp1y/pr58534.C: New testcase. * cpp1y/pr58536.C: New testcase. * cpp1y/pr58548.C: New testcase. * cpp1y/pr58549.C: New testcase. * cpp1y/pr58637.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr58534.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58536.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58548.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58549.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58637.C Modified: trunk/gcc/ChangeLog trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/cp/parser.c trunk/gcc/cp/parser.h trunk/gcc/testsuite/ChangeLog trunk/gcc/tree.c trunk/gcc/tree.h
[Bug c++/58549] [4.9 Regression] [c++1y] ICE with local function in function with auto parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58549 --- Comment #6 from abutcher at gcc dot gnu.org --- Author: abutcher Date: Tue Nov 12 20:17:33 2013 New Revision: 204714 URL: http://gcc.gnu.org/viewcvs?rev=204714root=gccview=rev Log: Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637. gcc/ * tree.c (grow_tree_vec_stat): New function ... * tree.h (grow_tree_vec_stat) (grow_tree_vec): ... and its declaration and macro front-end. gcc/cp/ PR c++/58534 PR c++/58536 PR c++/58548 PR c++/58549 PR c++/58637 * parser.h (struct cp_parser): New members implicit_template_parms, implicit_template_scope and auto_is_implicit_function_template_parm_p. * parser.c (add_implicit_template_parms): Refactor as ... (synthesize_implicit_template_parm): ... this to append a new template type parm to the current template parameter list (introducing a new list if necessary). Removed push_deferring_access_checks. (finish_fully_implicit_template): Removed pop_deferring_access_checks. (cp_parser_new): Initialize new cp_parser members. (cp_parser_parameter_declaration_clause): Consider auto as implicit template parm when parsing a parameter declaration (unless parsing an explicit specialization). (cp_parser_parameter_declaration_list): Remove local implicit_template_parms counter and reset cp_parser implicit template state when complete. (cp_parser_lambda_expression): Reset implicit template cp_parser members whilst generating lambda class. (cp_parser_function_definition_after_declarator): Reset implicit template cp_parser members whilst parsing function definition. (make_generic_type_name): Respell 'autoN' as 'auto:N' which works better with template diagnostics. (cp_parser_simple_type_specifier): Synthesize implicit template parm on parsing 'auto' if auto_is_implicit_function_template_parm_p and provide diagnostics ... * decl.c (grokdeclarator): ... that were previously done here. gcc/testsuite/g++.dg/ * cpp1y/pr58534.C: New testcase. * cpp1y/pr58536.C: New testcase. * cpp1y/pr58548.C: New testcase. * cpp1y/pr58549.C: New testcase. * cpp1y/pr58637.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr58534.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58536.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58548.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58549.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58637.C Modified: trunk/gcc/ChangeLog trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/cp/parser.c trunk/gcc/cp/parser.h trunk/gcc/testsuite/ChangeLog trunk/gcc/tree.c trunk/gcc/tree.h
[Bug c++/58548] [4.9 Regression] [c++1y] ICE with local struct in function with auto parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58548 --- Comment #4 from abutcher at gcc dot gnu.org --- Author: abutcher Date: Tue Nov 12 20:17:33 2013 New Revision: 204714 URL: http://gcc.gnu.org/viewcvs?rev=204714root=gccview=rev Log: Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637. gcc/ * tree.c (grow_tree_vec_stat): New function ... * tree.h (grow_tree_vec_stat) (grow_tree_vec): ... and its declaration and macro front-end. gcc/cp/ PR c++/58534 PR c++/58536 PR c++/58548 PR c++/58549 PR c++/58637 * parser.h (struct cp_parser): New members implicit_template_parms, implicit_template_scope and auto_is_implicit_function_template_parm_p. * parser.c (add_implicit_template_parms): Refactor as ... (synthesize_implicit_template_parm): ... this to append a new template type parm to the current template parameter list (introducing a new list if necessary). Removed push_deferring_access_checks. (finish_fully_implicit_template): Removed pop_deferring_access_checks. (cp_parser_new): Initialize new cp_parser members. (cp_parser_parameter_declaration_clause): Consider auto as implicit template parm when parsing a parameter declaration (unless parsing an explicit specialization). (cp_parser_parameter_declaration_list): Remove local implicit_template_parms counter and reset cp_parser implicit template state when complete. (cp_parser_lambda_expression): Reset implicit template cp_parser members whilst generating lambda class. (cp_parser_function_definition_after_declarator): Reset implicit template cp_parser members whilst parsing function definition. (make_generic_type_name): Respell 'autoN' as 'auto:N' which works better with template diagnostics. (cp_parser_simple_type_specifier): Synthesize implicit template parm on parsing 'auto' if auto_is_implicit_function_template_parm_p and provide diagnostics ... * decl.c (grokdeclarator): ... that were previously done here. gcc/testsuite/g++.dg/ * cpp1y/pr58534.C: New testcase. * cpp1y/pr58536.C: New testcase. * cpp1y/pr58548.C: New testcase. * cpp1y/pr58549.C: New testcase. * cpp1y/pr58637.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr58534.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58536.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58548.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58549.C trunk/gcc/testsuite/g++.dg/cpp1y/pr58637.C Modified: trunk/gcc/ChangeLog trunk/gcc/cp/ChangeLog trunk/gcc/cp/decl.c trunk/gcc/cp/parser.c trunk/gcc/cp/parser.h trunk/gcc/testsuite/ChangeLog trunk/gcc/tree.c trunk/gcc/tree.h
[Bug c++/58500] [C++1y] Crash with auto in function parameter
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58500 --- Comment #2 from abutcher at gcc dot gnu.org --- Author: abutcher Date: Mon Sep 23 22:43:44 2013 New Revision: 202851 URL: http://gcc.gnu.org/viewcvs?rev=202851root=gccview=rev Log: Fix 58500. gcc/cp/ PR c++/58500 * type-utils.h (find_type_usage): Only traverse one type level into member function pointers. gcc/testsuite/ PR c++/58500 * g++.dg/cpp1y/pr58500.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/cpp1y/pr58500.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/type-utils.h trunk/gcc/testsuite/ChangeLog