aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-09-03 22:34:35 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2008-09-03 22:34:35 +0200
commit3e03c9591c711e01ddcc3bfc01d18ac3a85eb852 (patch)
treeaf602b72b392b74728b687f7532308c6032fa143 /gcc/cp
parent3368cdd3f5f242e4ffe9147802591f5d9b5c40ec (diff)
downloadgcc-3e03c9591c711e01ddcc3bfc01d18ac3a85eb852.zip
gcc-3e03c9591c711e01ddcc3bfc01d18ac3a85eb852.tar.gz
gcc-3e03c9591c711e01ddcc3bfc01d18ac3a85eb852.tar.bz2
re PR c++/37348 (internal compiler error: tree check: expected var_decl, have field_decl in cp_finish_decl, at cp/decl.c:5461)
PR c++/37348 * decl.c (cp_finish_decl): Only set DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P if decl is VAR_DECL. * g++.dg/parse/crash45.C: New test. From-SVN: r139956
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/decl.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 442dd8e..4166bd1 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2008-09-03 Jakub Jelinek <jakub@redhat.com>
+ PR c++/37348
+ * decl.c (cp_finish_decl): Only set
+ DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P if decl is VAR_DECL.
+
PR c++/37189
* cp-tree.h (defer_mark_used_calls, deferred_mark_used_calls): New
extern decls.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index fbd16e5..c045353 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5517,7 +5517,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
DECL_INITIAL (decl) = NULL_TREE;
}
- if (init && init_const_expr_p)
+ if (init && init_const_expr_p && TREE_CODE (decl) == VAR_DECL)
{
DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl) = 1;
if (DECL_INTEGRAL_CONSTANT_VAR_P (decl))