aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiovanni Bajo <giovannibajo@libero.it>2003-06-30 13:07:32 -0600
committerWolfgang Bangerth <bangerth@gcc.gnu.org>2003-06-30 13:07:32 -0600
commit20929c7f42580c832d6bc0b2010e8e7ee70359b6 (patch)
treed75d608aa14435ea7d1ca7fef9c5af913db4d4c7
parentf8bee204f6b5c5d6cee07c631453f0cb503b3caf (diff)
downloadgcc-20929c7f42580c832d6bc0b2010e8e7ee70359b6.zip
gcc-20929c7f42580c832d6bc0b2010e8e7ee70359b6.tar.gz
gcc-20929c7f42580c832d6bc0b2010e8e7ee70359b6.tar.bz2
pt.c (value_dependent_expression_p): Cast expressions are value-dependent also if...
2003-06-30 Giovanni Bajo <giovannibajo@libero.it> * pt.c (value_dependent_expression_p): Cast expressions are value-dependent also if their operand is value-dependent itself. From-SVN: r68728
-rw-r--r--gcc/cp/pt.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 1b56f53..2d80847 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -11379,7 +11379,8 @@ dependent_type_p (tree type)
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)
@@ -11406,13 +11407,15 @@ value_dependent_expression_p (tree expression)
&& 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