@@ -792,8 +792,8 @@ maybe_add_lambda_conv_op (tree type)
particular, parameter pack expansions are marked
PACK_EXPANSION_LOCAL_P in
the body CALL, but not in DECLTYPE_CALL. */
- vec<tree, va_gc> *direct_argvec;
- tree decltype_call = 0, call;
+ vec<tree, va_gc> *direct_argvec = 0;
+ tree decltype_call = 0, call = 0;
tree fn_result = TREE_TYPE (TREE_TYPE (callop));
if (generic_lambda_p)
--
[PATCH 2/5] Don't accept 'auto' as the 'type' of a template parameter.
---
@@ -10323,7 +10323,12 @@ grokdeclarator (const cp_declarator
*declarator,
if (type_uses_auto (type))
{
- if (current_class_type && LAMBDA_TYPE_P (current_class_type))
+ if (template_parm_flag)
+ {
+ error ("template parameter declared %<auto%>");
+ type = error_mark_node;
+ }
+ else if (current_class_type && LAMBDA_TYPE_P (current_class_type))
{
if (cxx_dialect < cxx1y)
pedwarn (location_of (type), 0,
--
[PATCH 3/5] Fix location diagnostics by returning to the deprecated
'input_location' global; must be a better fix for this.
Using 'location_of (type)' yields "<built-in>: " rather than
"file:line:col: "
---
@@ -10331,18 +10331,18 @@ grokdeclarator (const cp_declarator
*declarator,
else if (current_class_type && LAMBDA_TYPE_P (current_class_type))
{
if (cxx_dialect < cxx1y)
- pedwarn (location_of (type), 0,
+ pedwarn (input_location, 0,
"use of %<auto%> in lambda parameter declaration "
"only available with "
"-std=c++1y or -std=gnu++1y");
}
else if (cxx_dialect < cxx1y)
- pedwarn (location_of (type), 0,
+ pedwarn (input_location, 0,
"use of %<auto%> in parameter declaration "
"only available with "
"-std=c++1y or -std=gnu++1y");
else
- pedwarn (location_of (type), OPT_Wpedantic,
+ pedwarn (input_location, OPT_Wpedantic,
"ISO C++ forbids use of %<auto%> in parameter "
"declaration");
}
--
[PATCH 4/5] Lift CALL_FROM_THUNK_P setting to above the potential
'build_cplus_new' call to prevent ICE due to unexpected tree type.
---
@@ -883,16 +883,17 @@ maybe_add_lambda_conv_op (tree type)
tf_warning_or_error);
--processing_template_decl;
}
+ CALL_FROM_THUNK_P (call) = 1;
}
else
{
call = build_call_a (callop,
direct_argvec->length (),
direct_argvec->address ());
+ CALL_FROM_THUNK_P (call) = 1;
if (MAYBE_CLASS_TYPE_P (TREE_TYPE (call)))
call = build_cplus_new (TREE_TYPE (call), call, tf_warning_or_error);
}
- CALL_FROM_THUNK_P (call) = 1;
tree stattype = build_function_type (fn_result, FUNCTION_ARG_CHAIN
(callop));
--
[PATCH 5/5] Handle forward declaration of implicit function templates.
Previously kept template parameter types in scope.
---
@@ -16295,10 +16295,12 @@ cp_parser_init_declarator (cp_parser* parser,
/* Peek at the next token. */
token = cp_lexer_peek_token (parser->lexer);
+
+ if (function_declarator_p (declarator))
+ {
/* Check to see if the token indicates the start of a
function-definition. */
- if (function_declarator_p (declarator)
- && cp_parser_token_starts_function_definition_p (token))
+ if (cp_parser_token_starts_function_definition_p (token))
{
if (!function_definition_allowed_p)
{
@@ -16346,6 +16348,9 @@ cp_parser_init_declarator (cp_parser* parser,
return decl;
}
}
+ else if (parser->fully_implicit_function_template_p)
+ decl = finish_fully_implicit_template (parser, decl);
+ }
/* [dcl.dcl]