Re: [PATCH 3/3] Support dumping type bindings in lambda diagnostics.

2013-08-27 Thread Adam Butcher
Hi Jason, Was just about to compose a mail to gcc-patches... Been busy, then ill, now just about ready to submit a new set of diffs. On 27.08.2013 17:47, Jason Merrill wrote: This patch doesn't seem to depend on the others; go ahead and apply it. Okay. As it stands, it means that you ge

[PATCH 1/4] Support lambda templates.

2013-08-27 Thread Adam Butcher
* parser.c (cp_parser_lambda_declarator_opt): Accept template parameter list with std=c++1y or std=gnu++1y. (cp_parser_lambda_body): Don't call 'expand_or_defer_fn' for lambda call operator template to avoid adding template result to symbol table. * lambda.c

Re: Lambda templates and implicit function templates.

2013-08-27 Thread Adam Butcher
Hi Jason, Here's an updated patch set. The fully_implicit_function_template_p field has been moved into cp_parser and the other comments addressed. I've done some testing with parameter packs also. They work okay with the explicit template parameter syntax for lambdas. Unfortunately, due to er

[PATCH 2/4] Don't generate lambda conversion op if arglist has parameter pack.

2013-08-27 Thread Adam Butcher
* lambda.c (maybe_add_lambda_conv_op): Optimize argvec building and early out if CALLOP contains a function parameter pack. --- gcc/cp/lambda.c | 60 ++--- 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/gcc/cp/lam

[PATCH 3/4] Support dumping type bindings in lambda diagnostics.

2013-08-27 Thread Adam Butcher
* error.c (dump_function_decl): Use standard diagnostic flow to dump a lambda diagnostic, albeit without stating the function name or duplicating the parameter spec (which is dumped as part of the type). --- gcc/cp/error.c | 22 +++--- 1 file changed, 11 ins

[PATCH 4/4] Support using 'auto' in a function parameter list to introduce an implicit template parameter.

2013-08-27 Thread Adam Butcher
* cp-tree.h (type_uses_auto_or_concept): Declare. (is_auto_or_concept): Declare. * decl.c (grokdeclarator): Allow 'auto' parameters with -std=gnu++1y or -std=c++1y. * type-utils.h: New header defining ... (find_type_usage): ... this new template based

[PATCH] Support dumping type bindings and 'mutable' qualifier in lambda diagnostics.

2013-08-28 Thread Adam Butcher
* error.c (dump_function_decl): Use standard diagnostic flow to dump a lambda diagnostic, albeit without stating the function name or duplicating the parameter spec (which is dumped as part of the type). Rather than qualifying the diagnostic with 'const' for plain la

[PATCH] Support dumping type bindings and 'mutable' qualifier in lambda diagnostics.

2013-08-29 Thread Adam Butcher
* error.c (dump_lambda_function): New function, dependent on ... (maybe_dump_template_bindings): ... this new function, factored out of ... (dump_function_decl): ... here. Updated to early-out with call to dump_lambda_function after determining template bind

Re: [PATCH] Support dumping type bindings and 'mutable' qualifier in lambda diagnostics.

2013-08-29 Thread Adam Butcher
On 29.08.2013 16:25, Gabriel Dos Reis wrote: On Thu, Aug 29, 2013 at 9:20 AM, Adam Butcher wrote: * error.c (dump_lambda_function): New function, dependent on ... (maybe_dump_template_bindings): ... this new function, factored out of ... (dump_function_decl

Re: [PATCH] Support dumping type bindings and 'mutable' qualifier in lambda diagnostics.

2013-08-29 Thread Adam Butcher
after determining template bindings. --- Hi Gaby, On 29.08.2013 18:04, Adam Butcher wrote: > On 29.08.2013 16:25, Gabriel Dos Reis wrote: > > > > Document the new functions. > > Use pp->translate_string ("with") instead of > > pp_cxx_ws_string (pp,

[PATCH, committed] Support dumping type bindings and 'mutable' qualifier in lambda diagnostics.

2013-08-29 Thread Adam Butcher
deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bf49198..f848b81 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2013-08-29 Adam Butcher + + * error.c (dump_lambda_function): New function, dependent on ... + (dump_substitution): ... this new

Re: [PATCH, committed] Support dumping type bindings and 'mutable' qualifier in lambda diagnostics.

2013-08-29 Thread Adam Butcher
On 29.08.2013 21:59, Gabriel Dos Reis wrote: On Thu, Aug 29, 2013 at 3:57 PM, Adam Butcher wrote: From: abutcher * error.c (dump_lambda_function): New function, dependent on ... (dump_substitution): ... this new function, factored out of ... (subst_to_string

Re: Lambda templates and implicit function templates.

2013-09-02 Thread Adam Butcher
On 01.09.2013 21:05, Jason Merrill wrote: On 08/27/2013 03:42 PM, Adam Butcher wrote: I don't know if it's the correct thing to do but the implementation currently omits the conversion to function pointer operator if the argument list contains a parameter pack. I would expect th

Re: [PATCH 1/4] Support lambda templates.

2013-09-02 Thread Adam Butcher
On 01.09.2013 21:22, Jason Merrill wrote: On 08/27/2013 03:42 PM, Adam Butcher wrote: + vec_safe_push (argvec, arg); I bet we want convert_from_reference in the non-generic lambda case, too. OK with that change. I think I had made that change originally to keep the two impls the

Re: [PATCH 4/4] Support using 'auto' in a function parameter list to introduce an implicit template parameter.

2013-09-02 Thread Adam Butcher
On 01.09.2013 22:20, Jason Merrill wrote: On 08/27/2013 03:42 PM, Adam Butcher wrote: + else // extend current template parameter list + // pop the innermost template parms into tparms Most comments should start with a capital letter and end with a period. Will change. + for

Re: [PATCH 1/4] Support lambda templates.

2013-09-02 Thread Adam Butcher
On 02.09.2013 19:34, Jason Merrill wrote: On 09/02/2013 02:30 PM, Adam Butcher wrote: On 01.09.2013 21:22, Jason Merrill wrote: I bet we want convert_from_reference in the non-generic lambda case, too. I think I had made that change originally to keep the two impls the same and I hit

Re: [PATCH 1/4] Support lambda templates.

2013-09-03 Thread Adam Butcher
On 03.09.2013 04:50, Jason Merrill wrote: On 09/02/2013 05:18 PM, Adam Butcher wrote: > will focus on the parameter pack stuff (when I get a chance). > Sounds good. I had a quick hack at getting pack expansion working for the conversion op. The syntactic side seems to be okay. It gets a

Re: [PATCH] [lambda] Extract lambda functions from semantics.c.

2013-09-04 Thread Adam Butcher
On 04.09.2013 03:41, Gabriel Dos Reis wrote: On Tue, Sep 3, 2013 at 9:33 PM, Mike Stump wrote: On Jul 12, 2013, at 11:18 PM, Adam Butcher wrote: * gcc/cp/semantics.c (build_lambda_expr), (build_lambda_object), (begin_lambda_type), (lambda_return_type), (lambda_function

Re: [PATCH] [lambda] Extract lambda functions from semantics.c.

2013-09-04 Thread Adam Butcher
On 04.09.2013 20:39, Gabriel Dos Reis wrote: On Wed, Sep 4, 2013 at 12:55 PM, Adam Butcher wrote: Is anyone working on using some use, perhaps filtered, of -MD (or -MDD) to generate deps on the fly? See Tom's patch series. Ah, yes. Cool. I guess it's just waiting on approva

Re: [PATCH 1/4] Support lambda templates.

2013-09-05 Thread Adam Butcher
On 03.09.2013 22:25, Jason Merrill wrote: On 09/03/2013 03:50 PM, Adam Butcher wrote: Problem is that no RTL is set for the incoming parms in the instantiation of the expansion. It ICEs in gimple_expand_cfg because 'DECL_RTL_IF_SET (var)' returns nullptr for the incoming parms resu

Re: [PATCH 1/4] Support lambda templates.

2013-09-05 Thread Adam Butcher
On 05.09.2013 20:14, Adam Butcher wrote: On 03.09.2013 22:25, Jason Merrill wrote: On 09/03/2013 03:50 PM, Adam Butcher wrote: Problem is that no RTL is set for the incoming parms in the instantiation of the expansion. It ICEs in gimple_expand_cfg because 'DECL_RTL_IF_SET (var)

Re: [PATCH 1/4] Support lambda templates.

2013-09-09 Thread Adam Butcher
;ve reworked the way the template op call is built (and built a separate call for the decltype expression). Cheers, Adam commit 29891189d498f5c6e3aabac72db14b94a200182c Author: Adam Butcher Date: Thu Aug 15 20:21:38 2013 +0100 [Intended for rollup into 1/4]: Handle parameter packs

[PATCH V4 2/2] Support using 'auto' in a function parameter list to introduce an implicit template parameter.

2013-09-09 Thread Adam Butcher
* cp-tree.h (type_uses_auto_or_concept): Declare. (is_auto_or_concept): Declare. * decl.c (grokdeclarator): Allow 'auto' parameters in lambdas with -std=gnu++1y or -std=c++1y or, as a GNU extension, in plain functions. * type-utils.h: New header defining ...

[PATCH V4 1/2] Support lambda templates.

2013-09-09 Thread Adam Butcher
* parser.c (cp_parser_lambda_declarator_opt): Accept template parameter list with std=c++1y or std=gnu++1y. (cp_parser_lambda_body): Don't call 'expand_or_defer_fn' for lambda call operator template to avoid adding template result to symbol table. * lambda.c

V4 Lambda templates and implicit function templates.

2013-09-09 Thread Adam Butcher
Hi Jason, Here's the latest patch set; reduced to two patches now. Remaining issues: - Instantiation of generic conversion op ICEs if the call op contains declarations and hasn't already been instantiated. - Still haven't figured out a clean way to make 'auto...' work. Cheers, Adam Patch s

Re: V4 Lambda templates and implicit function templates.

2013-09-11 Thread Adam Butcher
On 10.09.2013 03:19, Adam Butcher wrote: - Instantiation of generic conversion op ICEs if the call op contains declarations and hasn't already been instantiated. This is not a complete enough description. It only ICEs instantiating the call op through the decltype return o

Re: V4 Lambda templates and implicit function templates.

2013-09-11 Thread Adam Butcher
On 11.09.2013 16:25, Jason Merrill wrote: On 09/11/2013 10:42 AM, Jason Merrill wrote: Sounds like the problem is that the compiler is trying to instantiate a function while cp_unevaluated_operand is set. But that shouldn't be an issue because push_to_top_level clears cp_unevaluated_operand.

Re: [PATCH V4 2/2] Support using 'auto' in a function parameter list to introduce an implicit template parameter.

2013-09-12 Thread Adam Butcher
On 11.09.2013 17:02, Jason Merrill wrote: On 09/09/2013 10:19 PM, Adam Butcher wrote: + if (current_class_type && LAMBDA_TYPE_P (current_class_type)) + { + if (cxx_dialect < cxx1y) + pedwarn (location_of (type), 0, +

[PATCH, committed] Support decl instantiation in function-local templates.

2013-09-12 Thread Adam Butcher
--- gcc/cp/ChangeLog | 6 ++ gcc/cp/pt.c | 13 +++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9c99970..cbad022 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-09-12 Adam Butcher

[PATCH, committed] Support using 'auto' in a function parameter list to introduce an implicit template parameter.

2013-09-12 Thread Adam Butcher
g b/gcc/cp/ChangeLog index 66869d2..470fa1f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,37 @@ 2013-09-12 Adam Butcher + * cp-tree.h (type_uses_auto_or_concept): Declare. + (is_auto_or_concept): Declare. + * decl.c (grokdeclarator): Allow 'auto' parame

[PATCH, committed] Support lambda templates.

2013-09-12 Thread Adam Butcher
- gcc/cp/parser.c | 40 +++- gcc/cp/pt.c | 4 +- 5 files changed, 217 insertions(+), 38 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cbad022..66869d2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,22 @@ 2013-09-12 Adam Butch

Re: [PATCH, committed] Support lambda templates.

2013-09-12 Thread Adam Butcher
On 12.09.2013 23:44, Andrew MacLeod wrote: On 09/12/2013 06:41 PM, Andrew MacLeod wrote: On 09/12/2013 05:55 PM, Tobias Burnus wrote: Adam Butcher wrote: From: abutcher * lambda.c (lambda_function): Return template result if call operator is a template. I believe that that patch

[PATCH, committed] Fix uninitialized variables causing breakage with -Werror.

2013-09-12 Thread Adam Butcher
++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 68c8ea4..80e0d96 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2013-09-13 Adam Butcher + + * lambda.c (maybe_add_lambda_conv_op): Initialize direct_argvec

Re: [PATCH, committed] Support lambda templates.

2013-09-12 Thread Adam Butcher
On 13.09.2013 07:17, Adam Butcher wrote: On 12.09.2013 23:44, Andrew MacLeod wrote: On 09/12/2013 06:41 PM, Andrew MacLeod wrote: On 09/12/2013 05:55 PM, Tobias Burnus wrote: Adam Butcher wrote: From: abutcher * lambda.c (lambda_function): Return template result if call operator is

Re: [PATCH, committed] Support using 'auto' in a function parameter list to introduce an implicit template parameter.

2013-09-13 Thread Adam Butcher
On 13.09.2013 13:26, Andreas Schwab wrote: FAIL: g++.dg/cpp0x/auto3.C -std=c++11 (test for errors, line 24) FAIL: g++.dg/cpp0x/auto3.C -std=c++11 (test for excess errors) Excess errors: : error: use of 'auto' in parameter declaration only available with -std=c++1y or -std=gnu++1y I'm on it.

Generic lambda and implicit function template commits reverted

2013-09-13 Thread Adam Butcher
r202570 | abutcher | 2013-09-13 17:14:15 +0100 (Fri, 13 Sep 2013) | 7 lines Revert r202554, r202540 and r202539. - r202554: Fix uninitialized variables causing breakage with -Werror. - r202540: Support using 'auto' in a

Re: Generic lambda and implicit function template commits reverted

2013-09-15 Thread Adam Butcher
Hi Jason, Could you cast your eyes over these changes please? I intend to roll them up into the appropriate patches. I will make sure I bootstrap and "before-and-after" the g++.dg testsuite before pushing next time! [PATCH 1/5] Fix uninitialized variables causing breakage with -Werror. Not

Re: Generic lambda and implicit function template commits reverted

2013-09-15 Thread Adam Butcher
On 15.09.2013 15:45, Jason Merrill wrote: On 09/15/2013 06:22 AM, Adam Butcher wrote: [PATCH 1/5] Fix uninitialized variables causing breakage with -Werror. [PATCH 2/5] Don't accept 'auto' as the 'type' of a template parameter. OK. I've also added a case f

[PATCH, committed] * pt.c (make_auto_1): Use input_location rather than BUILTINS_LOCATION.

2013-09-16 Thread Adam Butcher
--- gcc/cp/pt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 2ef160a..ed08dca 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -21041,7 +21041,7 @@ static tree make_auto_1 (tree name) { tree au = cxx_make_type (TEMPLATE_TYPE_PARM); - TYPE_N

[PATCH, re-committed] Support lambda templates.

2013-09-16 Thread Adam Butcher
From: abutcher * parser.c (cp_parser_lambda_declarator_opt): Accept template parameter list with std=c++1y or std=gnu++1y. (cp_parser_lambda_body): Don't call 'expand_or_defer_fn' for lambda call operator template to avoid adding template result to symbol table.

[PATCH, re-committed] Support using 'auto' in a function parameter list to introduce an implicit template parameter.

2013-09-16 Thread Adam Butcher
From: abutcher gcc/cp/ * cp-tree.h (type_uses_auto_or_concept): Declare. (is_auto_or_concept): Declare. * decl.c (grokdeclarator): Allow 'auto' parameters in lambdas with -std=gnu++1y or -std=c++1y or, as a GNU extension, in plain functions. * type-utils.h:

Re: C++ PATCH for c++/41933 (variadic lambda capture)

2013-09-16 Thread Adam Butcher
Excellent. This now supports the variadic generic lambda from the spec (albeit without the auto parameter pack) auto vglambda = [](auto printer) { // TODO: return [=](auto&& ... ts) // OK: ts is a function parameter pack return [=] (T&& ... ts) // OK: ts is a function par

Re: [PATCH, committed] * pt.c (make_auto_1): Use input_location rather than BUILTINS_LOCATION.

2013-09-16 Thread Adam Butcher
On 16.09.2013 09:02, Eric Botcazou wrote: --- gcc/cp/pt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 2ef160a..ed08dca 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -21041,7 +21041,7 @@ static tree make_auto_1 (tree name) { tree au = c

Re: [PATCH, committed] * pt.c (make_auto_1): Use input_location rather than BUILTINS_LOCATION.

2013-09-16 Thread Adam Butcher
On 16.09.2013 17:54, Eric Botcazou wrote: Apologies if this was out of context. This was a change suggested and reviewed by Jason (http://gcc.gnu.org/ml/gcc-patches/2013-09/msg01114.html). Then don't repost it on gcc-patches, it is already available on gcc-cvs: http://gcc.gnu.org/ml/gcc-c

[C++1y] [PATCH 2/4] Support nested generic lambdas.

2013-09-19 Thread Adam Butcher
* lambda.c (maybe_add_lambda_conv_op): Don't check for instantiated callop in the case of generic lambdas. --- gcc/cp/lambda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index b04448b..2ffa7e0 100644 --- a/gcc/cp/lambda.c +

[C++1y] [PATCH 0/4] Fixes and enhancements to generic lambdas and implicit function templates.

2013-09-19 Thread Adam Butcher
Hi all, The following series contain a few miscellaneous updates to generic lambdas and implicit function templates. [1/4]: Use translation-unit-global rather than parameter-list-local counter for generic type names to facilitate nested implicit function templates. Using functio

[C++1y] [PATCH 3/4] Ensure implicit template parameters have distinct canonical types.

2013-09-19 Thread Adam Butcher
* parser.c (add_implicit_template_parms): Set the canonical type of a generic parameter to be that of the newly generated type such that it is unique. --- gcc/cp/parser.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 7e9ade2.

[C++1y] [PATCH 4/4] Generate more intuitive name for 'auto' parameters.

2013-09-19 Thread Adam Butcher
* parser.c (make_generic_type_name): Spell generic type names '' rather than '__GenN'. --- gcc/cp/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 148e2f2..a54496a 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c

[C++1y] [PATCH 1/4] Use translation-unit-global rather than parameter-list-local counter for generic type names to facilitate nested implicit function templates.

2013-09-19 Thread Adam Butcher
* parser.c (make_generic_type_name): Use static count rather than parameter and ... (add_implicit_template_parms): ... propagate interface change here. --- gcc/cp/parser.c | 25 ++--- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/gcc/cp

Re: [C++1y] [PATCH 1/4] Use translation-unit-global rather than parameter-list-local counter for generic type names to facilitate nested implicit function templates.

2013-09-22 Thread Adam Butcher
On 20.09.2013 18:46, Jason Merrill wrote: On 09/19/2013 02:37 PM, Adam Butcher wrote: + static int i = 0; I think this needs to be global and GTY so that it works properly with PCH. Didn't consider PCH. This delta OK? --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -28897,12 +288

Re: [C++1y] [PATCH 3/4] Ensure implicit template parameters have distinct canonical types.

2013-09-22 Thread Adam Butcher
On 20.09.2013 18:47, Jason Merrill wrote: Why is canonical_type_parameter not doing the right thing here? I don't see a reason we should need to treat these differently from normal template parms. The issue only happens with indirect parms. The type 'auto' is given a canonical type in make_au

Re: [C++1y] [PATCH 3/4] Ensure implicit template parameters have distinct canonical types.

2013-09-22 Thread Adam Butcher
On 22.09.2013 14:07, Adam Butcher wrote: On 20.09.2013 18:47, Jason Merrill wrote: Why is canonical_type_parameter not doing the right thing here? I don't see a reason we should need to treat these differently from normal template parms. The issue only happens with indirect parms. The

[C++1y] [Implicit Fix instantiation of implicit function template forward declarations.

2013-09-22 Thread Adam Butcher
Hi Jason, I noticed that, although implicit function template declarations were accepted. They weren't setup correctly and didn't instantiate properly. The following patch fixes this by moving finish_fully_implicit_template to the end of cp_parser_init_declarator. OK to go with the others?

[C++1y] [PATCH] Fix PR c++/58500

2013-09-23 Thread Adam Butcher
Hi, This fixes using 'auto' in the return type of a function pointer to introduce an implicit function template parameter. Note that this doesn't mean that 'auto' parameters in a function ptr will be treated the same; I think we need a special case for this in the implicit template parameter

Re: [C++1y] [PATCH 3/4] Ensure implicit template parameters have distinct canonical types.

2013-09-23 Thread Adam Butcher
On 22.09.2013 18:57, Adam Butcher wrote: The following solves the canonical type issue in the general case (pointers and refs) and makes it equivalent to the explicit template case -- in terms of canonical type at least. for (tree t = TREE_TYPE (TREE_VALUE (p)); t; t = TREE_CHAIN (t

Re: [C++1y] [Implicit Fix instantiation of implicit function template forward declarations.

2013-09-23 Thread Adam Butcher
On 23.09.2013 19:03, Jason Merrill wrote: On 09/23/2013 01:53 AM, Adam Butcher wrote: + if (member_p) +decl = finish_fully_implicit_template (parser, decl); + else +finish_fully_implicit_template (parser, /*member_decl_opt=*/0); Why don't we want to return the template for th

Re: [C++1y] [PATCH] Fix PR c++/58500

2013-09-23 Thread Adam Butcher
On 23.09.2013 19:02, Jason Merrill wrote: On 09/23/2013 02:08 AM, Adam Butcher wrote: Note that this doesn't mean that 'auto' parameters in a function ptr will be treated the same; I think we need a special case for this in the implicit template parameter introduction code

Re: [C++1y] [PATCH 3/4] ... canonical type workaround and refactoring

2013-09-24 Thread Adam Butcher
On 23.09.2013 08:15, Adam Butcher wrote: On 22.09.2013 18:57, Adam Butcher wrote: The following solves the canonical type issue in the general case (pointers and refs) and makes it equivalent to the explicit template case -- in terms of canonical type at least. for (tree t = TREE_TYPE

[SKETCH] Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637.

2013-10-07 Thread Adam Butcher
8.C | 10 ++ gcc/testsuite/g++.dg/cpp1y/pr58549.C | 10 ++ gcc/testsuite/g++.dg/cpp1y/pr58637.C | 7 + 8 files changed, 299 insertions(+), 106 deletions(-) commit 90c77cdd87eb63617719a9ad129803a2048761ff Author: Adam Butcher Date: Wed Sep 18 17:39:40 2013 +0100 Refactor implicit function temp

Re: [SKETCH] Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637.

2013-10-10 Thread Adam Butcher
On 2013-10-09 4:37, Jason Merrill wrote: On 10/07/2013 05:14 AM, Adam Butcher wrote: + /* Forbid ambiguous implicit pack expansions by only allowing +a single generic type in such a parameter. +XXX: Maybe allow if explicitly specified

Re: [SKETCH] Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637.

2013-10-11 Thread Adam Butcher
On 2013-10-11 3:26, Jason Merrill wrote: Can we put this in cp_parser, invert the sense of the flag, and only set it during cp_parser_parameter_declaration_clause? Done. But it still needs a flag to disable in the case of explicit template specialization. Can't you just check processing_spe

Re: [SKETCH] Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637.

2013-10-15 Thread Adam Butcher
On Wed, 25 Sep 2013 11:01:26 -0500, Jason Merrill wrote: On 09/24/2013 02:05 AM, Adam Butcher wrote: > On the subject of on-the-fly synthesis: I haven't started yet but I'm > thinking to trigger in 'cp_parser_simple_type_specifier' when > 'current_bindin

Re: [SKETCH] Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637.

2013-10-15 Thread Adam Butcher
On 2013-10-15 22:21, Adam Butcher wrote: On Wed, 25 Sep 2013 11:01:26 -0500, Jason Merrill wrote: > > 2) If we see 'auto', scan ahead (possibly via tentative parsing) to see if there's a ... > My current preferred option. The problem with it is that, ideally, I onl

[C++ PATCH 2/3] Support implicit parameter packs.

2013-11-02 Thread Adam Butcher
* parser.c (convert_generic_types_to_packs): New function to transform a range of implicitly introduced non-pack template parms to be parameter packs. (cp_parser_parameter_declaration_list): If a function parameter pack contains generic types, convert them to

Re: [SKETCH] Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637.

2013-11-02 Thread Adam Butcher
Hi Jason, I've got the tsubst solution for implicit parameter packs working now. I've also improved the efficiency of incremental template parameter synthesis and added some testcases. All C++14 generic lambda examples pass and no new regressions. Cheers, Adam Patch summary (3): Refactor im

[C++ PATCH 3/3] Add some generic lambda test cases.

2013-11-02 Thread Adam Butcher
gcc/testsuite/g++.dg/cpp1y/ * lambda-generic.C: New test case. * lambda-generic-cfun.C: New test case. * lambda-generic-dep.C: New test case. * lambda-generic-udt.C: New test case. * lambda-generic-variadic.C: New

[C++ PATCH 1/3] Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637.

2013-11-02 Thread Adam Butcher
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

[PATCH] PR c++/69139

2016-02-07 Thread Adam Butcher
PR c++/69139 * cp/parser.c (cp_parser_simple_type_specifier): Don't mistake 'auto' in trailing return function pointer types as an implicit template parameter. PR c++/69139 * g++.dg/cpp0x/trailing12.C: New test. --- gcc/cp/parser.c

[PATCH] Re: PR c++/69139

2016-02-08 Thread Adam Butcher
The following fixes up the handling of trailing returns with cv/ref specifiers mentioned by TC in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69139#c3. I've added handling of exception and transaction specs too. --- gcc/cp/parser.c | 12 ++-- gcc/testsuite/g++.dg

Re: [PATCH] PR c++/69139

2016-02-08 Thread Adam Butcher
On 2016-02-08 19:14, Patrick Palka wrote: On Mon, 8 Feb 2016, Jason Merrill wrote: On 02/08/2016 11:43 AM, Patrick Palka wrote: BTW, last month I posted a patch for this PR that handles all kinds of specifiers as well __attribute__ specifiers. Patch is at: https://gcc.gnu.org/ml/gcc-patches/2

[PATCH] Fix PR c++/59635

2014-01-04 Thread Adam Butcher
* cp/lambda.c (maybe_add_lambda_conv_op): Handle marking conversion function as unimplemented for generic lambdas with varargs. * g++.dg/opt/pr59635.C: New testcase. --- gcc/cp/lambda.c | 2 +- gcc/testsuite/g++.dg/cpp1y/pr59635.C | 9 + 2 file

[PATCH] Fix PR c++/59636

2014-01-04 Thread Adam Butcher
* 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. --- gcc/cp/parser.c | 12 ++-- gcc/testsuite/g++.dg/cpp1y/pr59636.C | 7 +++ 2 fi

Re: [PATCH] Fix PR c++/59635

2014-01-04 Thread Adam Butcher
On 2014-01-03 21:45, Adam Butcher wrote: * g++.dg/opt/pr59635.C: New testcase. s/opt/cpp1y/ +int (*p) (int, ...) = f; // { dg-error "unimplemented" } s/dg-error/dg-message/

[PATCH] Fix PR c++/59629

2014-01-05 Thread Adam Butcher
* 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. --- gcc/cp/parser.c | 5 + gcc/testsuite/g++.dg/cpp1y/pr59629.C | 7 +++ 2 fil

[PATCH] Fix PR c++/59638

2014-01-05 Thread Adam Butcher
* 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. --- gcc/cp/parser.c | 8 gcc/testsuite/g++.dg/cpp1y/pr59638.C | 16 +

Re: [PATCH] Fix PR c++/59638

2014-01-06 Thread Adam Butcher
On 2014-01-06 14:36, Jason Merrill wrote: On 01/04/2014 04:54 AM, Adam Butcher wrote: + /* Declarations involving function parameter lists containing implicit + template parameters will have been made into implicit templates. If they + do not turn out to be actual function

Re: [C++ PATCH] Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637.

2013-11-09 Thread Adam Butcher
On 2013-11-08 18:50, Jason Merrill wrote: On 10/31/2013 05:47 AM, Adam Butcher wrote: + become_template = true; + push_deferring_access_checks (dk_deferred); Why is this call here? I don't see anything in the rest of the function that would trigger an access check,

Re: [C++ PATCH] Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637.

2013-11-09 Thread Adam Butcher
On 2013-11-09 13:21, Adam Butcher wrote: On 2013-11-08 18:50, Jason Merrill wrote: On 10/31/2013 05:47 AM, Adam Butcher wrote: + become_template = true; + push_deferring_access_checks (dk_deferred); Why is this call here? I don't see anything in the rest of the fun

Re: [C++ PATCH] Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637.

2013-11-10 Thread Adam Butcher
On 2013-11-10 6:10, Jason Merrill wrote: Hmm, actually I think messing with the non-pack's decl is dangerous, and we should come up with a new decl for the pack instead. I think you can use reduce_template_parm_level with a "levels" argument of 0 to build a new decl and parm index. I actually

Re: [C++ PATCH] Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637.

2013-11-10 Thread Adam Butcher
On 2013-11-10 10:38, Adam Butcher wrote: On 2013-11-10 6:10, Jason Merrill wrote: Hmm, actually I think messing with the non-pack's decl is dangerous, and we should come up with a new decl for the pack instead. I think you can use reduce_template_parm_level with a "levels" a

Re: [C++ PATCH] Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637.

2013-11-10 Thread Adam Butcher
On 2013-11-10 18:49, Jason Merrill wrote: On 11/10/2013 08:10 AM, Adam Butcher wrote: + /* Build up a tree vec of empty tree vecs up to the inner substitution +args built above. */ I think we want to copy the enclosing args; see existing uses of add_outermost_template_args

Re: [C++ PATCH] Refactor implicit function template implementation and fix 58534, 58536, 58548, 58549 and 58637.

2013-11-11 Thread Adam Butcher
On 2013-11-10 23:21, Jason Merrill wrote: On 11/10/2013 02:39 PM, Adam Butcher wrote: I assumed that tsubst simply doesn't do anything with a null tree substitution (i.e. it is an identity op). Substituting NULL_TREE for a template parameter gives a template parameter with a reduced

[PATCH] Fix c++/59112 and c++/59113: Disallow implicit function templates in local functions unless defining a lambda.

2013-11-24 Thread Adam Butcher
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

[PATCH] Fix PR c++/61537

2014-06-24 Thread Adam Butcher
* parser.c (cp_parser_elaborated_type_specifier): Only consider template parameter lists outside of function parameter scope. * g++.dg/cpp1y/pr61537.C: New testcase. --- gcc/cp/parser.c | 28 +++- gcc/testsuite/g++.dg/cpp1y/pr61

Re: [PATCH] Fix PR c++/61537

2014-06-24 Thread Adam Butcher
On 2014-06-24 23:22, Paolo Carlini wrote: On 06/24/2014 01:40 AM, Adam Butcher wrote: +// { dg-do compile { target c++1y } } I don't think this is a C++1y specific issue... You're right. I'm so used to creating pr testcases in that g++.dg/cpp1y dir, I automatically added

Re: [PATCH] Fix PR c++/61537

2014-06-25 Thread Adam Butcher
* parser.c (cp_parser_elaborated_type_specifier): Only consider template parameter lists outside of function parameter scope. * g++.dg/template/pr61537.C: New testcase. --- gcc/cp/parser.c | 31 ++- gcc/testsuite/g++.dg/t

Re: [PATCH] Fix PR c++/61537

2014-06-25 Thread Adam Butcher
On 2014-06-25 21:57, Jason Merrill wrote: OK, thanks. Do you want me to apply to 4.9 too?

Re: [PATCH 1/2] PR c++/61636

2015-04-17 Thread Adam Butcher
On 2015-04-17 20:58, Jason Merrill wrote: On 04/09/2015 11:31 PM, Adam Butcher wrote: + /* For generic lambdas, resolve default captured 'this' now. */ This isn't quite right. We don't want to capture 'this' any time we see a member function call

Re: [PATCH 1/2] PR c++/61636

2015-04-18 Thread Adam Butcher
On 2015-04-17 22:06, Adam Butcher wrote: On 2015-04-17 20:58, Jason Merrill wrote: On 04/09/2015 11:31 PM, Adam Butcher wrote: + /* For generic lambdas, resolve default captured 'this' now. */ This isn't quite right. We don't want to capture 'this&

Re: [PATCH 1/2] PR c++/61636

2015-04-19 Thread Adam Butcher
On 2015-04-18 18:53, Adam Butcher wrote: Test like this? /* { dg-do run { target c++14 } } */ /* { dg-final { scan-assembler-not "..." } } */ struct X { int f (int, double) { return 255; } static int f (int, int) { return 65535; } auto m1 () { return [=] (auto a) {

Re: [PATCH 1/2] ?PR c++/61636

2015-04-20 Thread Adam Butcher
On 2015-04-20 11:25, Marek Polacek wrote: On Sat, Apr 18, 2015 at 06:53:28PM +0100, Adam Butcher wrote: Test like this? /* { dg-do run { target c++14 } } */ /* { dg-final { scan-assembler-not "..." } } */ What is this dg-final supposed to do here? It was a placeholder for m

[PATCH 1/2] PR c++/61636 * cp/parser.c (cp_parser_postfix_expression): Resolve default captured 'this' early for generic lambdas.

2015-04-13 Thread Adam Butcher
PR c++/61636 * g++.dg/cpp1y/pr61636.C: New test. --- gcc/cp/parser.c | 16 gcc/testsuite/g++.dg/cpp1y/pr61636.C | 19 +++ 2 files changed, 35 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/pr61636.C diff --git a/g

[PATCH 2/2] 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 wit

2015-04-13 Thread Adam Butcher
PR c++/64382 * g++.dg/cpp1y/pr64382.C: New test. --- gcc/cp/cp-tree.h | 1 + gcc/cp/parser.c | 21 + gcc/cp/semantics.c | 8 +--- gcc/testsuite/g++.dg/cpp1y/pr64382.C | 23 +++

[PATCH] [PR c++/61636 and c++/64382] Fix default capture in generic lambdas

2015-04-13 Thread Adam Butcher
Hi Jason, I finally scraped some time together to look into these two generic lambda default capture bugs and believe I have a solution. Still have to run tests but I thought I'd get these out for your perusal whilst I rebase onto origin/master and run the testsuite. Cheers, Adam

Re: [PATCH 2/2] 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

2015-04-14 Thread Adam Butcher
On 2015-04-14 8:26, Jakub Jelinek wrote: I'd say best would be to just use separate ifs with return false. Done.

Re: [PATCH 2/2] PR c++/64382 * cp/parser.c (parsing_default_capturing_generic_lambda_in_template)...

2015-04-14 Thread Adam Butcher
On 2015-04-10 4:31, Adam Butcher wrote: +parsing_default_capturing_generic_lambda_in_template (void) I'm wondering whether we should cache this as a bool on the parser. Currently it is called once per id-expression and will always return the same result for any given lambda.

[PATCH] PR c++/65750

2015-04-14 Thread Adam Butcher
* cp/parser.c (cp_parser_simple_type_specifier): Don't synthesize implicit template parm if 'auto' is a placeholder for trailing return type. --- gcc/cp/parser.c | 23 +++ gcc/testsuite/g++.dg/cpp1y/pr65750.C | 12 2 fil

Re: [PATCH] PR c++/65750

2015-04-14 Thread Adam Butcher
On 2015-04-10 15:57, Adam Butcher wrote: + cp_lexer_consume_token (parser->lexer); Actually there should be two of these as the 'auto' isn't consumed yet.

Re: [C++ Patch] Remove is_auto_or_concept, etc

2017-05-16 Thread Adam Butcher
Sorry for not getting back to your original post Paolo. I haven't been picking up mails for a while. On 2017-05-01 16:56, Jason Merrill wrote: On Thu, Apr 27, 2017 at 2:02 PM, Paolo Carlini wrote: On 26/04/2017 12:32, Paolo Carlini wrote: in 2013 (2013-09-16) Adam added two slightly obscur

[PATCH] Fix PR c++/64382

2017-01-19 Thread Adam Butcher
Hi Jason, I've reopened 64382 and unhooked it from 61636 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64382#c6). This is a rebase of my original patch for 64382 from April 2015 against latest master. My query about caching parsing_default_capturing_generic_lambda_in_template() still applies. I

  1   2   >