SWITCH_STMT_NO_BREAK_P (in SWITCH_STMT)
LAMBDA_EXPR_CAPTURE_OPTIMIZED (in LAMBDA_EXPR)
IMPLICIT_CONV_EXPR_BRACED_INIT (in IMPLICIT_CONV_EXPR)
- TINFO_VAR_DECLARED_CONSTINIT (in TEMPLATE_INFO)
CALL_FROM_NEW_OR_DELETE_P (in CALL_EXPR)
3: IMPLICIT_RVALUE_P (in NON_LVALUE_EXPR or STATIC_CAST_EXPR)
ICS_BAD_FLAG (in _CONV)
TYPE_DECL_ALIAS_P (in TYPE_DECL)
7: DECL_THUNK_P (in a member FUNCTION_DECL)
DECL_NORMAL_CAPTURE_P (in FIELD_DECL)
+ DECL_DECLARED_CONSTINIT_P (in VAR_DECL)
8: DECL_DECLARED_CONSTEXPR_P (in VAR_DECL, FUNCTION_DECL)
Usage of language-independent fields in a language-dependent manner:
#define TINFO_USED_TEMPLATE_ID(NODE) \
(TREE_LANG_FLAG_1 (TEMPLATE_INFO_CHECK (NODE)))
-/* Non-zero if this variable template specialization was declared with the
- `constinit' specifier. */
-#define TINFO_VAR_DECLARED_CONSTINIT(NODE) \
- (TREE_LANG_FLAG_2 (TEMPLATE_INFO_CHECK (NODE)))
-
/* The representation of a deferred access check. */
struct GTY(()) deferred_access_check {
#define DECL_EXTERN_C_FUNCTION_P(NODE) \
(DECL_NON_THUNK_FUNCTION_P (NODE) && DECL_EXTERN_C_P (NODE))
+/* Non-zero if this variable is declared `constinit' specifier. */
+#define DECL_DECLARED_CONSTINIT_P(NODE) \
+ (DECL_LANG_FLAG_7 (VAR_DECL_CHECK (NODE)))
+
/* True if DECL is declared 'constexpr'. */
#define DECL_DECLARED_CONSTEXPR_P(DECL) \
DECL_LANG_FLAG_8 (VAR_OR_FUNCTION_DECL_CHECK (STRIP_TEMPLATE (DECL)))
decl = maybe_push_decl (decl);
if (processing_template_decl)
- {
- /* Make sure that for a `constinit' decl push_template_decl creates
- a DECL_TEMPLATE_INFO info for us, so that cp_finish_decl can then set
- TINFO_VAR_DECLARED_CONSTINIT. */
- if (decl_spec_seq_has_spec_p (declspecs, ds_constinit))
- retrofit_lang_decl (decl);
- decl = push_template_decl (decl);
- }
+ decl = push_template_decl (decl);
+
if (decl == error_mark_node)
return error_mark_node;
/* Handle `constinit' on variable templates. */
if (flags & LOOKUP_CONSTINIT)
- TINFO_VAR_DECLARED_CONSTINIT (DECL_TEMPLATE_INFO (decl)) = true;
+ DECL_DECLARED_CONSTINIT_P (decl) = true;
/* Generally, initializers in templates are expanded when the
template is instantiated. But, if DECL is a variable constant
DECL_TEMPLATE_INFO (r) = build_template_info (tmpl, argvec);
SET_DECL_IMPLICIT_INSTANTIATION (r);
- /* Remember whether we require constant initialization of
- a non-constant template variable. */
- TINFO_VAR_DECLARED_CONSTINIT (DECL_TEMPLATE_INFO (r))
- = TINFO_VAR_DECLARED_CONSTINIT (DECL_TEMPLATE_INFO (t));
if (!error_operand_p (r) || (complain & tf_error))
register_specialization (r, gen_tmpl, argvec, false, hash);
}
else
{
init = DECL_INITIAL (decl);
- /* The following tsubst call will clear the DECL_TEMPLATE_INFO
- for local variables, so save if DECL was declared constinit. */
- const bool constinit_p
- = (VAR_P (decl)
- && DECL_LANG_SPECIFIC (decl)
- && DECL_TEMPLATE_INFO (decl)
- && TINFO_VAR_DECLARED_CONSTINIT (DECL_TEMPLATE_INFO (decl)));
decl = tsubst (decl, args, complain, in_decl);
if (decl != error_mark_node)
{
now. */
predeclare_vla (decl);
+ bool constinit_p
+ = VAR_P (decl) && DECL_DECLARED_CONSTINIT_P (decl);
cp_finish_decl (decl, init, const_init, NULL_TREE,
constinit_p ? LOOKUP_CONSTINIT : 0);
push_nested_class (DECL_CONTEXT (d));
const_init = DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (code_pattern);
- int flags = (TINFO_VAR_DECLARED_CONSTINIT (DECL_TEMPLATE_INFO (d))
- ? LOOKUP_CONSTINIT : 0);
+ int flags = (DECL_DECLARED_CONSTINIT_P (d) ? LOOKUP_CONSTINIT : 0);
cp_finish_decl (d, init, const_init, NULL_TREE, flags);
if (enter_context)