summaryrefslogtreecommitdiff
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0324-PR-c-49105.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/0324-PR-c-49105.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/0324-PR-c-49105.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0324-PR-c-49105.patch75
1 files changed, 75 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0324-PR-c-49105.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0324-PR-c-49105.patch
new file mode 100644
index 000000000..895fc54ae
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0324-PR-c-49105.patch
@@ -0,0 +1,75 @@
+From 64c58ffe439f284f8ff22900f2bbd4923e92d835 Mon Sep 17 00:00:00 2001
+From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Wed, 25 May 2011 01:08:38 +0000
+Subject: [PATCH] PR c++/49105
+ * typeck.c (build_const_cast_1): Handle rvalue references.
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174162 138bc75d-0d04-0410-961f-82ee72b054a4
+
+index 9a81ea5..578eb83 100644
+--- a/gcc/cp/typeck.c
++++ b/gcc/cp/typeck.c
+@@ -6220,14 +6220,29 @@ build_const_cast_1 (tree dst_type, tree expr, bool complain,
+
+ /* [expr.const.cast]
+
+- An lvalue of type T1 can be explicitly converted to an lvalue of
+- type T2 using the cast const_cast<T2&> (where T1 and T2 are object
+- types) if a pointer to T1 can be explicitly converted to the type
+- pointer to T2 using a const_cast. */
++ For two object types T1 and T2, if a pointer to T1 can be explicitly
++ converted to the type "pointer to T2" using a const_cast, then the
++ following conversions can also be made:
++
++ -- an lvalue of type T1 can be explicitly converted to an lvalue of
++ type T2 using the cast const_cast<T2&>;
++
++ -- a glvalue of type T1 can be explicitly converted to an xvalue of
++ type T2 using the cast const_cast<T2&&>; and
++
++ -- if T1 is a class type, a prvalue of type T1 can be explicitly
++ converted to an xvalue of type T2 using the cast const_cast<T2&&>. */
++
+ if (TREE_CODE (dst_type) == REFERENCE_TYPE)
+ {
+ reference_type = dst_type;
+- if (! real_lvalue_p (expr))
++ if (!TYPE_REF_IS_RVALUE (dst_type)
++ ? real_lvalue_p (expr)
++ : (CLASS_TYPE_P (TREE_TYPE (dst_type))
++ ? lvalue_p (expr)
++ : lvalue_or_rvalue_with_address_p (expr)))
++ /* OK. */;
++ else
+ {
+ if (complain)
+ error ("invalid const_cast of an rvalue of type %qT to type %qT",
+new file mode 100644
+index 0000000..94ee4ca
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp0x/rv-cast2.C
+@@ -0,0 +1,21 @@
++// Test for const_cast to reference (5.2.11/4).
++// { dg-options -std=c++0x }
++
++template <class T> T&& xval();
++template <class T> T& lval();
++template <class T> T prval();
++
++struct A { };
++
++int main()
++{
++ const_cast<int&>(lval<int>());
++ const_cast<int&>(xval<int>()); // { dg-error "" }
++ const_cast<int&>(prval<int>()); // { dg-error "" }
++ const_cast<int&&>(lval<int>());
++ const_cast<int&&>(xval<int>());
++ const_cast<int&&>(prval<int>()); // { dg-error "" }
++ const_cast<A&&>(lval<A>());
++ const_cast<A&&>(xval<A>());
++ const_cast<A&&>(prval<A>());
++}
+--
+1.7.0.4
+