summaryrefslogtreecommitdiff
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0357-PR-c-48657.patch
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2011-06-12 20:56:57 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-14 14:37:31 +0100
commit3968f33b6542cf20cf63cf49bfbc033bd2486295 (patch)
tree2bdb5e2f692a3bd3ecadbf2b4c7dc9f54485c737 /meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0357-PR-c-48657.patch
parent022ca1d1357caafdfe23aa9ab82f90ba89b6942b (diff)
downloadopenembedded-core-3968f33b6542cf20cf63cf49bfbc033bd2486295.tar.gz
openembedded-core-3968f33b6542cf20cf63cf49bfbc033bd2486295.tar.bz2
openembedded-core-3968f33b6542cf20cf63cf49bfbc033bd2486295.tar.xz
openembedded-core-3968f33b6542cf20cf63cf49bfbc033bd2486295.zip
gcc-4.6.0: Bring in patches from FSF 4.6 branch
This brings in new patches from 4.6 release branch updates the comment section of existing branch to not contain patch numbers. Tested build on qemu for arm ppc mips x86 and x86_64 Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0357-PR-c-48657.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0357-PR-c-48657.patch149
1 files changed, 149 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0357-PR-c-48657.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0357-PR-c-48657.patch
new file mode 100644
index 000000000..49a0763db
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0357-PR-c-48657.patch
@@ -0,0 +1,149 @@
+From 04ed2c7147286ab11c8ba25e486e3f726c4970d4 Mon Sep 17 00:00:00 2001
+From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Fri, 27 May 2011 18:10:48 +0000
+Subject: [PATCH] PR c++/48657
+ PR c++/49176
+ * decl.c (cp_finish_decl): Simplify template handling.
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174346 138bc75d-0d04-0410-961f-82ee72b054a4
+
+index dac87dd..8395b2b 100644
+--- a/gcc/cp/decl.c
++++ b/gcc/cp/decl.c
+@@ -5760,7 +5760,6 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
+ const char *asmspec = NULL;
+ int was_readonly = 0;
+ bool var_definition_p = false;
+- int saved_processing_template_decl;
+ tree auto_node;
+
+ if (decl == error_mark_node)
+@@ -5782,7 +5781,6 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
+
+ /* Assume no cleanup is required. */
+ cleanup = NULL_TREE;
+- saved_processing_template_decl = processing_template_decl;
+
+ /* If a name was specified, get the string. */
+ if (global_scope_p (current_binding_level))
+@@ -5882,45 +5880,24 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
+ template is instantiated. But, if DECL is a variable constant
+ then it can be used in future constant expressions, so its value
+ must be available. */
+- if (!(init
+- && init_const_expr_p
+- && !type_dependent_p
+- && decl_maybe_constant_var_p (decl)
+- && !value_dependent_init_p (init)))
+- {
+- if (init)
+- DECL_INITIAL (decl) = init;
+- if (TREE_CODE (decl) == VAR_DECL
+- && !DECL_PRETTY_FUNCTION_P (decl)
+- && !type_dependent_p)
+- maybe_deduce_size_from_array_init (decl, init);
+- goto finish_end;
+- }
+-
+- if (!DECL_CLASS_SCOPE_P (decl))
++ if (init
++ && init_const_expr_p
++ && !type_dependent_p
++ && decl_maybe_constant_var_p (decl)
++ && !value_dependent_init_p (init))
+ {
+ tree init_code = check_initializer (decl, init, flags, &cleanup);
+- if (init_code)
+- DECL_INITIAL (decl) = init;
+- goto finish_end;
++ if (init_code == NULL_TREE)
++ init = NULL_TREE;
+ }
++ else if (TREE_CODE (decl) == VAR_DECL
++ && !DECL_PRETTY_FUNCTION_P (decl)
++ && !type_dependent_p)
++ maybe_deduce_size_from_array_init (decl, init);
+
+- if (TREE_CODE (init) == TREE_LIST)
+- {
+- /* If the parenthesized-initializer form was used (e.g.,
+- "int A<N>::i(X)"), then INIT will be a TREE_LIST of initializer
+- arguments. (There is generally only one.) We convert them
+- individually. */
+- tree list = init;
+- for (; list; list = TREE_CHAIN (list))
+- {
+- tree elt = TREE_VALUE (list);
+- TREE_VALUE (list) = fold_non_dependent_expr (elt);
+- }
+- }
+- else
+- init = fold_non_dependent_expr (init);
+- processing_template_decl = 0;
++ if (init)
++ DECL_INITIAL (decl) = init;
++ return;
+ }
+
+ /* Take care of TYPE_DECLs up front. */
+@@ -5943,7 +5920,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
+
+ rest_of_decl_compilation (decl, DECL_FILE_SCOPE_P (decl),
+ at_eof);
+- goto finish_end;
++ return;
+ }
+
+ /* A reference will be modified here, as it is initialized. */
+@@ -6067,8 +6044,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
+ else if (TREE_CODE (type) == ARRAY_TYPE)
+ layout_type (type);
+
+- if (!processing_template_decl
+- && TREE_STATIC (decl)
++ if (TREE_STATIC (decl)
+ && !at_function_scope_p ()
+ && current_function_decl == NULL)
+ /* So decl is a global variable or a static member of a
+@@ -6088,9 +6064,8 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
+
+ /* Let the middle end know about variables and functions -- but not
+ static data members in uninstantiated class templates. */
+- if (!saved_processing_template_decl
+- && (TREE_CODE (decl) == VAR_DECL
+- || TREE_CODE (decl) == FUNCTION_DECL))
++ if (TREE_CODE (decl) == VAR_DECL
++ || TREE_CODE (decl) == FUNCTION_DECL)
+ {
+ if (TREE_CODE (decl) == VAR_DECL)
+ {
+@@ -6177,9 +6152,6 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
+ if (cleanup)
+ push_cleanup (decl, cleanup, false);
+
+- finish_end:
+- processing_template_decl = saved_processing_template_decl;
+-
+ if (was_readonly)
+ TREE_READONLY (decl) = 1;
+ }
+new file mode 100644
+index 0000000..5d3ec5b
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/template/const5.C
+@@ -0,0 +1,12 @@
++// PR c++/49176
++// { dg-options -std=c++0x }
++
++struct A { static int a(); };
++
++template<int>
++struct B { static int const b; };
++
++int f() { return B<0>::b; }
++
++template<int I>
++int const B<I>::b=A::a();
+--
+1.7.0.4
+