summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-08 14:35:15 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-08 14:35:15 +0000
commit33edce94e22ce6c5832cba9cd2234baa245b81bc (patch)
tree5b9c9eecfd3c61bffba699534ed26b1873849673 /gcc/cp
parentf96c6662eb5d8337426d8e13ec4aae8b810ebe25 (diff)
downloadgcc-33edce94e22ce6c5832cba9cd2234baa245b81bc.tar.gz
2014-01-08 Basile Starynkevitch <basile@starynkevitch.net>
{{merge using svnmerge.py with trunk GCC 4.9 svn rev.206423. All is well compiled.}} git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@206427 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog33
-rw-r--r--gcc/cp/lambda.c2
-rw-r--r--gcc/cp/mangle.c3
-rw-r--r--gcc/cp/parser.c26
-rw-r--r--gcc/cp/pt.c11
-rw-r--r--gcc/cp/semantics.c3
6 files changed, 69 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1f5ddb52bcb..bf2a593917c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,36 @@
+2014-01-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/58856
+ * pt.c (num_innermost_template_parms): New.
+ (get_underlying_template): Use it.
+
+ PR c++/58965
+ * mangle.c (write_guarded_var_name): Handle null DECL_NAME.
+
+2014-01-07 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * semantics.c (trait_expr_value, [CPTK_IS_BASE_OF]): Implement
+ the letter of 20.11.6 about Base and Derived naming the same
+ class type modulo cv-qualifiers.
+
+2014-01-06 Adam Butcher <adam@jessamine.co.uk>
+
+ PR c++/59635
+ * lambda.c (maybe_add_lambda_conv_op): Handle marking conversion
+ function as unimplemented for generic lambdas with varargs.
+
+ PR c++/59636
+ * parser.c (cp_parser_template_parameter): Early out with
+ error_mark_node if parameter declaration was not parsed.
+
+ PR c++/59629
+ * parser.c (cp_parser_lambda_expression): Save/reset/restore
+ auto_is_implicit_function_template_parm_p around lambda body.
+
+ PR c++/59638
+ * parser.c (cp_parser_init_declarator): Undo fully implicit
+ template parameter list when declarator is not a function.
+
2014-01-03 Marc Glisse <marc.glisse@inria.fr>
PR c++/58950
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index 1855716532a..8bb820d0c3b 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -970,7 +970,7 @@ maybe_add_lambda_conv_op (tree type)
the conversion op is used. */
if (varargs_function_p (callop))
{
- DECL_DELETED_FN (fn) = 1;
+ DECL_DELETED_FN (STRIP_TEMPLATE (fn)) = 1;
return;
}
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 6f32a43f323..dc7d4eab901 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -3775,7 +3775,8 @@ mangle_conv_op_name_for_type (const tree type)
static void
write_guarded_var_name (const tree variable)
{
- if (strncmp (IDENTIFIER_POINTER (DECL_NAME (variable)), "_ZGR", 4) == 0)
+ if (DECL_NAME (variable)
+ && strncmp (IDENTIFIER_POINTER (DECL_NAME (variable)), "_ZGR", 4) == 0)
/* The name of a guard variable for a reference temporary should refer
to the reference, not the temporary. */
write_string (IDENTIFIER_POINTER (DECL_NAME (variable)) + 4);
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index c99c1fcb645..8c615200e54 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -8738,6 +8738,8 @@ cp_parser_lambda_expression (cp_parser* parser)
= parser->fully_implicit_function_template_p;
tree implicit_template_parms = parser->implicit_template_parms;
cp_binding_level* implicit_template_scope = parser->implicit_template_scope;
+ bool auto_is_implicit_function_template_parm_p
+ = parser->auto_is_implicit_function_template_parm_p;
parser->num_template_parameter_lists = 0;
parser->in_statement = 0;
@@ -8745,6 +8747,7 @@ cp_parser_lambda_expression (cp_parser* parser)
parser->fully_implicit_function_template_p = false;
parser->implicit_template_parms = 0;
parser->implicit_template_scope = 0;
+ parser->auto_is_implicit_function_template_parm_p = false;
/* By virtue of defining a local class, a lambda expression has access to
the private variables of enclosing classes. */
@@ -8772,6 +8775,8 @@ cp_parser_lambda_expression (cp_parser* parser)
= fully_implicit_function_template_p;
parser->implicit_template_parms = implicit_template_parms;
parser->implicit_template_scope = implicit_template_scope;
+ parser->auto_is_implicit_function_template_parm_p
+ = auto_is_implicit_function_template_parm_p;
}
pop_deferring_access_checks ();
@@ -12977,20 +12982,21 @@ cp_parser_template_parameter (cp_parser* parser, bool *is_non_type,
= cp_parser_parameter_declaration (parser, /*template_parm_p=*/true,
/*parenthesized_p=*/NULL);
+ if (!parameter_declarator)
+ return error_mark_node;
+
/* If the parameter declaration is marked as a parameter pack, set
*IS_PARAMETER_PACK to notify the caller. Also, unmark the
declarator's PACK_EXPANSION_P, otherwise we'll get errors from
grokdeclarator. */
- if (parameter_declarator
- && parameter_declarator->declarator
+ if (parameter_declarator->declarator
&& parameter_declarator->declarator->parameter_pack_p)
{
*is_parameter_pack = true;
parameter_declarator->declarator->parameter_pack_p = false;
}
- if (parameter_declarator
- && parameter_declarator->default_argument)
+ if (parameter_declarator->default_argument)
{
/* Can happen in some cases of erroneous input (c++/34892). */
if (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS))
@@ -13014,8 +13020,7 @@ cp_parser_template_parameter (cp_parser* parser, bool *is_non_type,
/* We might end up with a pack expansion as the type of the non-type
template parameter, in which case this is a non-type template
parameter pack. */
- else if (parameter_declarator
- && parameter_declarator->decl_specifiers.type
+ else if (parameter_declarator->decl_specifiers.type
&& PACK_EXPANSION_P (parameter_declarator->decl_specifiers.type))
{
*is_parameter_pack = true;
@@ -16775,6 +16780,15 @@ cp_parser_init_declarator (cp_parser* parser,
warning (OPT_Wattributes,
"attributes after parenthesized initializer ignored");
+ /* A non-template declaration involving a function parameter list containing
+ an implicit template parameter will have been made into a template. If it
+ turns out that the resulting declaration is not an actual function then
+ finish the template declaration here. An error message will already have
+ been issued. */
+ if (parser->fully_implicit_function_template_p)
+ if (!function_declarator_p (declarator))
+ finish_fully_implicit_template (parser, /*member_decl_opt=*/0);
+
/* For an in-class declaration, use `grokfield' to create the
declaration. */
if (member_p)
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 98d7365a7cc..2e7cf60ba7d 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -5149,6 +5149,15 @@ alias_template_specialization_p (const_tree t)
&& DECL_ALIAS_TEMPLATE_P (TYPE_TI_TEMPLATE (t)));
}
+/* Return the number of innermost template parameters in TMPL. */
+
+static int
+num_innermost_template_parms (tree tmpl)
+{
+ tree parms = INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (tmpl));
+ return TREE_VEC_LENGTH (parms);
+}
+
/* Return either TMPL or another template that it is equivalent to under DR
1286: An alias that just changes the name of a template is equivalent to
the other template. */
@@ -5164,6 +5173,8 @@ get_underlying_template (tree tmpl)
{
tree sub = TYPE_TI_TEMPLATE (result);
if (PRIMARY_TEMPLATE_P (sub)
+ && (num_innermost_template_parms (tmpl)
+ == num_innermost_template_parms (sub))
&& same_type_p (result, TREE_TYPE (sub)))
{
/* The alias type is equivalent to the pattern of the
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 0bb64c7752b..9f878874e6d 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -7106,7 +7106,8 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2)
case CPTK_IS_BASE_OF:
return (NON_UNION_CLASS_TYPE_P (type1) && NON_UNION_CLASS_TYPE_P (type2)
- && DERIVED_FROM_P (type1, type2));
+ && (same_type_ignoring_top_level_qualifiers_p (type1, type2)
+ || DERIVED_FROM_P (type1, type2)));
case CPTK_IS_CLASS:
return (NON_UNION_CLASS_TYPE_P (type1));