CALL_EXPR_REVERSE_ARGS (in CALL_EXPR, AGGR_INIT_EXPR)
CONSTRUCTOR_PLACEHOLDER_BOUNDARY (in CONSTRUCTOR)
OVL_EXPORT_P (in OVERLOAD)
+ DECL_NTTP_OBJECT_P (in VAR_DECL)
6: TYPE_MARKED_P (in _TYPE)
DECL_NONTRIVIALLY_INITIALIZED_P (in VAR_DECL)
RANGE_FOR_IVDEP (in RANGE_FOR_STMT)
#define DECL_TINFO_P(NODE) \
TREE_LANG_FLAG_4 (TREE_CHECK2 (NODE,VAR_DECL,TYPE_DECL))
+/* true iff VAR_DECL node NODE is a NTTP object decl. */
+#define DECL_NTTP_OBJECT_P(NODE) \
+ TREE_LANG_FLAG_5 (TREE_CHECK (NODE,VAR_DECL))
+
/* 1 iff VAR_DECL node NODE is virtual table or VTT. We forward to
DECL_VIRTUAL_P from the common code, as that has the semantics we
need. But we want a more descriptive name. */
enum { nt_opaque = false, nt_transparent = true };
extern tree alias_template_specialization_p (const_tree, bool);
extern tree dependent_alias_template_spec_p (const_tree, bool);
-extern bool template_parm_object_p (const_tree);
+extern tree get_template_parm_object (tree expr, tree mangle);
extern tree tparm_object_argument (tree);
extern bool explicit_class_specialization_p (tree);
extern bool push_tinst_level (tree);
return unify_invalid (explain_p);
}
-/* True if T is a C++20 template parameter object to store the argument for a
- template parameter of class type. */
-
-bool
-template_parm_object_p (const_tree t)
-{
- return (TREE_CODE (t) == VAR_DECL && DECL_ARTIFICIAL (t) && DECL_NAME (t)
- && startswith (IDENTIFIER_POINTER (DECL_NAME (t)), "_ZTA"));
-}
-
/* Subroutine of convert_nontype_argument, to check whether EXPR, as an
argument for TYPE, points to an unsuitable object.
}
-/* The template arguments corresponding to template parameter objects of types
- that contain pointers to members. */
-
-static GTY(()) hash_map<tree, tree> *tparm_obj_values;
-
/* Return a VAR_DECL for the C++20 template parameter object corresponding to
template argument EXPR. */
static tree
-get_template_parm_object (tree expr, tsubst_flags_t complain)
+create_template_parm_object (tree expr, tsubst_flags_t complain)
{
if (TREE_CODE (expr) == TARGET_EXPR)
expr = TARGET_EXPR_INITIAL (expr);
/* This is no longer a compound literal. */
gcc_assert (!TREE_HAS_CONSTRUCTOR (expr));
- tree name = mangle_template_parm_object (expr);
+ return get_template_parm_object (expr, mangle_template_parm_object (expr));
+}
+
+/* The template arguments corresponding to template parameter objects of types
+ that contain pointers to members. */
+
+static GTY(()) hash_map<tree, tree> *tparm_obj_values;
+
+/* Find or build an nttp object for (already-validated) EXPR with name
+ NAME. */
+
+tree
+get_template_parm_object (tree expr, tree name)
+{
tree decl = get_global_binding (name);
if (decl)
return decl;
tree type = cp_build_qualified_type (TREE_TYPE (expr), TYPE_QUAL_CONST);
decl = create_temporary_var (type);
+ DECL_NTTP_OBJECT_P (decl) = true;
DECL_CONTEXT (decl) = NULL_TREE;
TREE_STATIC (decl) = true;
DECL_DECLARED_CONSTEXPR_P (decl) = true;
/* Replace the argument with a reference to the corresponding template
parameter object. */
if (!val_dep_p)
- expr = get_template_parm_object (expr, complain);
+ expr = create_template_parm_object (expr, complain);
if (expr == error_mark_node)
return NULL_TREE;
}