diff options
author | giovannibajo <giovannibajo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-03-19 09:58:50 +0000 |
---|---|---|
committer | giovannibajo <giovannibajo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-03-19 09:58:50 +0000 |
commit | 9ee4e816aa4a11be1c2da196861eb8f5d20f7a62 (patch) | |
tree | 2875ba12f6981d9b9cdec73133129e43d4a3728c /gcc/cp/pt.c | |
parent | d45cef9bf61bc04f0153b88852766cff70c4a293 (diff) | |
download | gcc-9ee4e816aa4a11be1c2da196861eb8f5d20f7a62.tar.gz |
PR c++/14545
* parser.c (cp_parser_functional_cast): A cast to anything
but integral or enumaration type is not an integral constant
expression.
* pt.c (value_dependent_expression_p): Handle cast expressions
without operands (such as "int()").
PR c++/14545
* g++.dg/parse/template15.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@79672 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r-- | gcc/cp/pt.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 365cb18bf66..3719410ad0d 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11776,10 +11776,21 @@ value_dependent_expression_p (tree expression) || TREE_CODE (expression) == REINTERPRET_CAST_EXPR || TREE_CODE (expression) == CAST_EXPR) { - if (dependent_type_p (TREE_TYPE (expression))) + tree type = TREE_TYPE (expression); + if (dependent_type_p (type)) return true; /* A functional cast has a list of operands. */ expression = TREE_OPERAND (expression, 0); + if (!expression) + { + /* If there are no operands, it must be an expression such + as "int()". This should not happen for aggregate types + because it would form non-constant expressions. */ + my_friendly_assert (INTEGRAL_OR_ENUMERATION_TYPE_P (type), + 20040318); + + return false; + } if (TREE_CODE (expression) == TREE_LIST) { do |