From: jakub Date: Wed, 3 Sep 2008 20:34:35 +0000 (+0000) Subject: PR c++/37348 X-Git-Tag: upstream/4.9.2~39898 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=62dfea2eac7039147403952b5bd691c36cea4579;p=platform%2Fupstream%2Flinaro-gcc.git 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139956 138bc75d-0d04-0410-961f-82ee72b054a4 --- 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 + 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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bfadce1..b1d9324 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2008-09-03 Jakub Jelinek + PR c++/37348 + * g++.dg/parse/crash45.C: New test. + PR c++/37189 * g++.dg/gomp/pr37189.C: New test. diff --git a/gcc/testsuite/g++.dg/parse/crash45.C b/gcc/testsuite/g++.dg/parse/crash45.C new file mode 100644 index 0000000..8696ab4 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/crash45.C @@ -0,0 +1,7 @@ +// PR c++/37348 +// { dg-do compile } + +struct A +{ + template int f (B); // { dg-error "was not declared in this scope|cannot be a member template" } +};