|
|
01e27f8 |
2001-01-11 Nathan Sidwell <nathan@codesourcery.com>
|
|
|
01e27f8 |
|
|
|
01e27f8 |
* typeck.c (build_c_cast): Do template processing earlier.
|
|
|
01e27f8 |
|
|
|
01e27f8 |
2001-08-09 Jakub Jelinek <jakub@redhat.com>
|
|
|
01e27f8 |
|
|
|
01e27f8 |
* g++.old-deja/g++.other/array3.C: New test.
|
|
|
01e27f8 |
|
|
|
01e27f8 |
--- gcc/cp/typeck.c.jj Wed Aug 8 18:37:25 2001
|
|
|
01e27f8 |
+++ gcc/cp/typeck.c Thu Aug 9 16:34:32 2001
|
|
|
01e27f8 |
@@ -5361,6 +5361,13 @@ build_c_cast (type, expr)
|
|
|
01e27f8 |
if (type == error_mark_node || expr == error_mark_node)
|
|
|
01e27f8 |
return error_mark_node;
|
|
|
01e27f8 |
|
|
|
01e27f8 |
+ if (processing_template_decl)
|
|
|
01e27f8 |
+ {
|
|
|
01e27f8 |
+ tree t = build_min (CAST_EXPR, type,
|
|
|
01e27f8 |
+ tree_cons (NULL_TREE, value, NULL_TREE));
|
|
|
01e27f8 |
+ return t;
|
|
|
01e27f8 |
+ }
|
|
|
01e27f8 |
+
|
|
|
01e27f8 |
/* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
|
|
|
01e27f8 |
Strip such NOP_EXPRs if VALUE is being used in non-lvalue context. */
|
|
|
01e27f8 |
if (TREE_CODE (type) != REFERENCE_TYPE
|
|
|
01e27f8 |
@@ -5393,13 +5400,6 @@ build_c_cast (type, expr)
|
|
|
01e27f8 |
{
|
|
|
01e27f8 |
cp_error ("invalid cast to function type `%T'", type);
|
|
|
01e27f8 |
return error_mark_node;
|
|
|
01e27f8 |
- }
|
|
|
01e27f8 |
-
|
|
|
01e27f8 |
- if (processing_template_decl)
|
|
|
01e27f8 |
- {
|
|
|
01e27f8 |
- tree t = build_min (CAST_EXPR, type,
|
|
|
01e27f8 |
- tree_cons (NULL_TREE, value, NULL_TREE));
|
|
|
01e27f8 |
- return t;
|
|
|
01e27f8 |
}
|
|
|
01e27f8 |
|
|
|
01e27f8 |
if (TREE_CODE (type) == VOID_TYPE)
|
|
|
01e27f8 |
--- gcc/testsuite/g++.old-deja/g++.other/array3.C.jj Thu Aug 9 16:39:26 2001
|
|
|
01e27f8 |
+++ gcc/testsuite/g++.old-deja/g++.other/array3.C Thu Aug 9 16:40:13 2001
|
|
|
01e27f8 |
@@ -0,0 +1,6 @@
|
|
|
01e27f8 |
+// Build don't link:
|
|
|
01e27f8 |
+
|
|
|
01e27f8 |
+template <class T> class A {
|
|
|
01e27f8 |
+ T *d;
|
|
|
01e27f8 |
+ public: void f() { (T[10])d; }
|
|
|
01e27f8 |
+};
|