This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C++ PATCH] fix value_dependent_expression_p for *_CAST_EXPR


Hello,

as discussed here: http://gcc.gnu.org/ml/gcc/2003-06/msg01478.html

Bootstrapped on i686-pc-cygwin (c, c++, java), regtested with "make
check-g++" with no new regressions.

OK for mainline?

Giovanni Bajo



2003-06-17  Giovanni Bajo  <giovannibajo@libero.it>

        * pt.c (value_dependent_expression_p): Cast expressions are
        value-dependent also if their operand is value-dependent itself.

Index: pt.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.697
diff -u -w -r1.697 pt.c
--- pt.c 3 Jun 2003 13:01:43 -0000 1.697
+++ pt.c 18 Jun 2003 10:51:58 -0000
@@ -11535,7 +11537,8 @@
   return TYPE_DEPENDENT_P (type);
 }

-/* Returns TRUE if the EXPRESSION is value-dependent.  */
+/* Returns TRUE if the EXPRESSION is value-dependent, in the sense of
+   [temp.dep.constexpr] */

 bool
 value_dependent_expression_p (tree expression)
@@ -11562,13 +11565,15 @@
       && value_dependent_expression_p (DECL_INITIAL (expression)))
     return true;
   /* These expressions are value-dependent if the type to which the
-     cast occurs is dependent.  */
+     cast occurs is dependent or the expression being casted is
+     value-dependent.  */
   if ((TREE_CODE (expression) == DYNAMIC_CAST_EXPR
        || TREE_CODE (expression) == STATIC_CAST_EXPR
        || TREE_CODE (expression) == CONST_CAST_EXPR
        || TREE_CODE (expression) == REINTERPRET_CAST_EXPR
        || TREE_CODE (expression) == CAST_EXPR)
-      && dependent_type_p (TREE_TYPE (expression)))
+      && (dependent_type_p (TREE_TYPE (expression))
+   || value_dependent_expression_p (TREE_OPERAND (expression, 0))))
     return true;
   /* A `sizeof' expression where the sizeof operand is a type is
      value-dependent if the type is dependent.  If the type was not


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]