+2005-07-18 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/22263
+ * cp-tree.h (instantiate_decl): Change prototype.
+ * decl2.c (mark_used): Adjust accordingly.
+ * pt.c (do_decl_instantiation): Likewise.
+ (instantiate_class_member): Likewise.
+ (instantiate_decl): Rename undefined_ok as expl_inst_class_mem_p.
+ Clear DECL_INTERFACE_KNOWN for an explicitly instantiated template
+ that has no definition available.
+ (instantiate_pending_templates): Adjust call to instantiate_decl.
+
2005-07-17 Mark Mitchell <mark@codesourcery.com>
PR c++/22139
extern void mark_class_instantiated (tree, int);
extern void do_decl_instantiation (tree, tree);
extern void do_type_instantiation (tree, tree, tsubst_flags_t);
-extern tree instantiate_decl (tree, int, int);
+extern tree instantiate_decl (tree, int, bool);
extern int push_tinst_level (tree);
extern void pop_tinst_level (void);
extern int more_specialized_class (tree, tree, tree);
mark_decl_instantiated (result, extern_p);
if (! extern_p)
- instantiate_decl (result, /*defer_ok=*/1, /*undefined_ok=*/0);
+ instantiate_decl (result, /*defer_ok=*/1,
+ /*expl_inst_class_mem_p=*/false);
}
void
{
mark_decl_instantiated (decl, extern_p);
if (! extern_p)
- instantiate_decl (decl, /*defer_ok=*/1, /* undefined_ok=*/1);
+ instantiate_decl (decl, /*defer_ok=*/1,
+ /*expl_inst_class_mem_p=*/true);
}
/* Perform an explicit instantiation of template class T. STORAGE, if
DEFER_OK is nonzero, then we don't have to actually do the
instantiation now; we just have to do it sometime. Normally it is
an error if this is an explicit instantiation but D is undefined.
- If UNDEFINED_OK is nonzero, then instead we treat it as an implicit
- instantiation. UNDEFINED_OK is nonzero only if we are being used
- to instantiate the members of an explicitly instantiated class
- template. */
-
+ EXPL_INST_CLASS_MEM_P is true iff D is a member of an
+ explicitly instantiated class template. */
tree
-instantiate_decl (tree d, int defer_ok, int undefined_ok)
+instantiate_decl (tree d, int defer_ok,
+ bool expl_inst_class_mem_p)
{
tree tmpl = DECL_TI_TEMPLATE (d);
tree gen_args;
input_location = DECL_SOURCE_LOCATION (d);
- if (! pattern_defined && DECL_EXPLICIT_INSTANTIATION (d) && undefined_ok)
+ /* If D is a member of an explicitly instantiated class template,
+ and no definition is available, treat it like an implicit
+ instantiation. */
+ if (!pattern_defined && expl_inst_class_mem_p
+ && DECL_EXPLICIT_INSTANTIATION (d))
{
DECL_NOT_REALLY_EXTERN (d) = 0;
+ DECL_INTERFACE_KNOWN (d) = 0;
SET_DECL_IMPLICIT_INSTANTIATION (d);
}
fn;
fn = TREE_CHAIN (fn))
if (! DECL_ARTIFICIAL (fn))
- instantiate_decl (fn, /*defer_ok=*/0,
- /*undefined_ok=*/0);
+ instantiate_decl (fn,
+ /*defer_ok=*/0,
+ /*expl_inst_class_mem_p=*/false);
if (COMPLETE_TYPE_P (instantiation))
reconsider = 1;
}
if (!DECL_TEMPLATE_SPECIALIZATION (instantiation)
&& !DECL_TEMPLATE_INSTANTIATED (instantiation))
{
- instantiation = instantiate_decl (instantiation,
- /*defer_ok=*/0,
- /*undefined_ok=*/0);
+ instantiation
+ = instantiate_decl (instantiation,
+ /*defer_ok=*/0,
+ /*expl_inst_class_mem_p=*/false);
if (DECL_TEMPLATE_INSTANTIATED (instantiation))
reconsider = 1;
}