2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL).
DECL_IMPLICIT_TYPEDEF_P (in a TYPE_DECL)
TEMPLATE_DECL_COMPLEX_ALIAS_P (in TEMPLATE_DECL)
+ DECL_INSTANTIATING_NSDMI_P (in a FIELD_DECL)
3: DECL_IN_AGGR_P.
4: DECL_C_BIT_FIELD (in a FIELD_DECL)
DECL_ANON_UNION_VAR_P (in a VAR_DECL)
#define DECL_ARRAY_PARAMETER_P(NODE) \
DECL_LANG_FLAG_1 (PARM_DECL_CHECK (NODE))
+/* Nonzero for a FIELD_DECL who's NSMDI is currently being
+ instantiated. */
+#define DECL_INSTANTIATING_NSDMI_P(NODE) \
+ DECL_LANG_FLAG_2 (FIELD_DECL_CHECK (NODE))
+
/* Nonzero for FIELD_DECL node means that this field is a base class
of the parent object, as opposed to a member field. */
#define DECL_FIELD_IS_BASE(NODE) \
tree init;
tree save_ccp = current_class_ptr;
tree save_ccr = current_class_ref;
+
if (!in_ctor)
{
/* Use a PLACEHOLDER_EXPR when we don't have a 'this' parameter to
current_class_ref = build0 (PLACEHOLDER_EXPR, DECL_CONTEXT (member));
current_class_ptr = build_address (current_class_ref);
}
+
if (DECL_LANG_SPECIFIC (member) && DECL_TEMPLATE_INFO (member))
{
- /* Do deferred instantiation of the NSDMI. */
- init = (tsubst_copy_and_build
- (DECL_INITIAL (DECL_TI_TEMPLATE (member)),
- DECL_TI_ARGS (member),
- tf_warning_or_error, member, /*function_p=*/false,
- /*integral_constant_expression_p=*/false));
-
- init = digest_nsdmi_init (member, init);
+ init = DECL_INITIAL (DECL_TI_TEMPLATE (member));
+ if (TREE_CODE (init) == DEFAULT_ARG)
+ goto unparsed;
+
+ /* Check recursive instantiation. */
+ if (DECL_INSTANTIATING_NSDMI_P (member))
+ {
+ error ("recursive instantiation of non-static data member "
+ "initializer for %qD", member);
+ init = error_mark_node;
+ }
+ else
+ {
+ DECL_INSTANTIATING_NSDMI_P (member) = 1;
+
+ /* Do deferred instantiation of the NSDMI. */
+ init = (tsubst_copy_and_build
+ (init, DECL_TI_ARGS (member),
+ tf_warning_or_error, member, /*function_p=*/false,
+ /*integral_constant_expression_p=*/false));
+ init = digest_nsdmi_init (member, init);
+
+ DECL_INSTANTIATING_NSDMI_P (member) = 0;
+ }
}
else
{
init = DECL_INITIAL (member);
if (init && TREE_CODE (init) == DEFAULT_ARG)
{
+ unparsed:
error ("constructor required before non-static data member "
"for %qD has been parsed", member);
DECL_INITIAL (member) = error_mark_node;