1999-04-30 Mark Mitchell <mark@codesourcery.com>
+ * typeck.c (build_const_cast): Tweak last change to handle
+ templates correctly.
+
* typeck.c (build_const_cast): Disallow use of const_cast to
anything but a pointer or reference type.
if (type == error_mark_node || expr == error_mark_node)
return error_mark_node;
- if (!POINTER_TYPE_P (type) && !TYPE_PTRMEMFUNC_P (type))
- {
- cp_error ("`%T' is not a pointer, reference, or pointer-to-member type",
- type);
- cp_error ("as required by const_cast");
- return error_mark_node;
- }
-
if (TREE_CODE (expr) == OFFSET_REF)
expr = resolve_offset_ref (expr);
return t;
}
+ if (!POINTER_TYPE_P (type) && !TYPE_PTRMEMFUNC_P (type))
+ {
+ cp_error ("`%T' is not a pointer, reference, or pointer-to-member type",
+ type);
+ cp_error ("as required by const_cast");
+ return error_mark_node;
+ }
+
if (TREE_CODE (type) != REFERENCE_TYPE)
{
expr = decay_conversion (expr);