+2003-09-05 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12163
+ * call.c (perform_direct_initialization): Correct logic for
+ direct-initialization of a class type.
+
+ PR c++/12146
+ * pt.c (lookup_template_function): Robustify.
+
2003-09-05 Nathan Sidwell <nathan@codesourcery.com>
PR c++/11922
/* Convert EXPR to TYPE (as a direct-initialization) if that is
permitted. If the conversion is valid, the converted expression is
- returned. Otherwise, NULL_TREE is returned. */
+ returned. Otherwise, NULL_TREE is returned, except in the case
+ that TYPE is a class type; in that case, an error is issued. */
tree
perform_direct_initialization_if_possible (tree type, tree expr)
if (type == error_mark_node || error_operand_p (expr))
return error_mark_node;
+ /* [dcl.init]
+
+ If the destination type is a (possibly cv-qualified) class type:
+
+ -- If the initialization is direct-initialization ...,
+ constructors are considered. ... If no constructor applies, or
+ the overload resolution is ambiguous, the initialization is
+ ill-formed. */
+ if (CLASS_TYPE_P (type))
+ return build_special_member_call (NULL_TREE, complete_ctor_identifier,
+ build_tree_list (NULL_TREE, expr),
+ TYPE_BINFO (type),
+ LOOKUP_NORMAL);
conv = implicit_conversion (type, TREE_TYPE (expr), expr,
LOOKUP_NORMAL);
if (!conv || ICS_BAD_FLAG (conv))
return error_mark_node;
my_friendly_assert (!arglist || TREE_CODE (arglist) == TREE_VEC, 20030726);
- if (fns == NULL_TREE)
+ if (fns == NULL_TREE
+ || TREE_CODE (fns) == FUNCTION_DECL)
{
error ("non-template used as template");
return error_mark_node;
+2003-09-05 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/12163
+ * g++.dg/expr/static_cast4.C: New test.
+
+ PR c++/12146
+ * g++.dg/template/crash9.C: New test.
+
2003-09-05 Andrew Pinski <pinskia@physics.uc.edu>
* g++.old-deja/g++.ext/pretty2.C: Update for change