+2016-12-07 Nathan Sidwell <nathan@acm.org>
+
+ * cp-tree.h (enum cp_tree_index): Add CPTI_AUTO_IDENTIFIER &
+ CPTI_DECLTYPE_AUTO_IDENTIFIER.
+ (auto_identifier, decltype_auto_identifier): New.
+ *decl.c (initialize_predefined_identifiers): Add 'auto' and
+ 'decltype(auto)'.
+ (grokdeclarator): Use cached identifier.
+ * pt.c (make_decltype_auto, make_auto, make_constrained_auto,
+ is_auto): Likewise.
+
2016-12-02 Jakub Jelinek <jakub@redhat.com>
PR c++/78649
CPTI_PFN_IDENTIFIER,
CPTI_VPTR_IDENTIFIER,
CPTI_STD_IDENTIFIER,
+ CPTI_AUTO_IDENTIFIER,
+ CPTI_DECLTYPE_AUTO_IDENTIFIER,
CPTI_LANG_NAME_C,
CPTI_LANG_NAME_CPLUSPLUS,
#define vptr_identifier cp_global_trees[CPTI_VPTR_IDENTIFIER]
/* The name of the std namespace. */
#define std_identifier cp_global_trees[CPTI_STD_IDENTIFIER]
+/* auto and declspec(auto) identifiers. */
+#define auto_identifier cp_global_trees[CPTI_AUTO_IDENTIFIER]
+#define decltype_auto_identifier cp_global_trees[CPTI_DECLTYPE_AUTO_IDENTIFIER]
/* The name of a C++17 deduction guide. */
#define lang_name_c cp_global_trees[CPTI_LANG_NAME_C]
#define lang_name_cplusplus cp_global_trees[CPTI_LANG_NAME_CPLUSPLUS]
{ "__vtt_parm", &vtt_parm_identifier, 0 },
{ "::", &global_scope_name, 0 },
{ "std", &std_identifier, 0 },
+ { "auto", &auto_identifier, 0 },
+ { "decltype(auto)", &decltype_auto_identifier, 0 },
{ NULL, NULL, 0 }
};
gcc_unreachable ();
}
if (TREE_CODE (type) != TEMPLATE_TYPE_PARM
- || TYPE_IDENTIFIER (type) != get_identifier ("auto"))
+ || TYPE_IDENTIFIER (type) != auto_identifier)
{
if (type != error_mark_node)
{
tree
make_decltype_auto (void)
{
- return make_auto_1 (get_identifier ("decltype(auto)"), true);
+ return make_auto_1 (decltype_auto_identifier, true);
}
tree
make_auto (void)
{
- return make_auto_1 (get_identifier ("auto"), true);
+ return make_auto_1 (auto_identifier, true);
}
/* Return a C++17 deduction placeholder for class template TMPL. */
tree
make_constrained_auto (tree con, tree args)
{
- tree type = make_auto_1 (get_identifier ("auto"), false);
+ tree type = make_auto_1 (auto_identifier, false);
/* Build the constraint. */
tree tmpl = DECL_TI_TEMPLATE (con);
is_auto (const_tree type)
{
if (TREE_CODE (type) == TEMPLATE_TYPE_PARM
- && (TYPE_IDENTIFIER (type) == get_identifier ("auto")
- || TYPE_IDENTIFIER (type) == get_identifier ("decltype(auto)")
+ && (TYPE_IDENTIFIER (type) == auto_identifier
+ || TYPE_IDENTIFIER (type) == decltype_auto_identifier
|| CLASS_PLACEHOLDER_TEMPLATE (type)))
return true;
else