2001-01-12 Nathan Sidwell <nathan@codesourcery.com>
+ * typeck.c (build_c_cast): Do template processing earlier.
+ Always pedwarn on array casts.
+
+2001-01-12 Nathan Sidwell <nathan@codesourcery.com>
+
* friend.c (make_friend_class): Make sure a templated class is
actually a template.
if (type == error_mark_node || expr == error_mark_node)
return error_mark_node;
+ if (processing_template_decl)
+ {
+ tree t = build_min (CAST_EXPR, type,
+ tree_cons (NULL_TREE, value, NULL_TREE));
+ return t;
+ }
+
/* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
Strip such NOP_EXPRs if VALUE is being used in non-lvalue context. */
if (TREE_CODE (type) != REFERENCE_TYPE
NIHCL uses it. It is not valid ISO C++ however. */
if (TREE_CODE (TREE_TYPE (expr)) == POINTER_TYPE)
{
- if (pedantic)
- pedwarn ("ISO C++ forbids casting to an array type");
+ cp_pedwarn ("ISO C++ forbids casting to an array type `%T'", type);
type = build_pointer_type (TREE_TYPE (type));
}
else
{
- error ("ISO C++ forbids casting to an array type");
+ cp_error ("ISO C++ forbids casting to an array type `%T'", type);
return error_mark_node;
}
}
return error_mark_node;
}
- if (processing_template_decl)
- {
- tree t = build_min (CAST_EXPR, type,
- tree_cons (NULL_TREE, value, NULL_TREE));
- return t;
- }
-
if (TREE_CODE (type) == VOID_TYPE)
{
/* Conversion to void does not cause any of the normal function to
2001-01-12 Nathan Sidwell <nathan@codesourcery.com>
+ * g++.old-deja/g++.pt/cast2.C: New test.
+
+2001-01-12 Nathan Sidwell <nathan@codesourcery.com>
+
* g++.old-deja/g++.pt/friend47.C: New test.
2001-01-11 Nathan Sidwell <nathan@codesourcery.com>
--- /dev/null
+// Build don't link:
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 10 Jan 2001 <nathan@codesourcery.com>
+
+// Bug 1588. We ICE'd on reparsing an absdcl as a cast inside a template
+// function.
+
+class A {
+public:
+ template <class T> void f(void *CLUTp);
+};
+
+template <class T> void A::f(void *CLUTp)
+{
+ void *CLUT;
+
+ CLUT = (unsigned char [3][256])CLUTp; // ERROR - cast to array
+
+ return;
+}
+
+
+int main()
+{
+ A myobj;
+ unsigned char t[3][256];
+
+ myobj.f<unsigned char>(t);
+
+ return 0;
+}