aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0029-PR-c-47999.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0029-PR-c-47999.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0029-PR-c-47999.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0029-PR-c-47999.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0029-PR-c-47999.patch
new file mode 100644
index 0000000000..d890d92782
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0029-PR-c-47999.patch
@@ -0,0 +1,57 @@
+From d1f71a5193dd2b3debd551f3dc0e0d237acf7e81 Mon Sep 17 00:00:00 2001
+From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Tue, 29 Mar 2011 14:25:37 +0000
+Subject: [PATCH 029/200] PR c++/47999
+ * semantics.c (finish_call_expr): Preserve reference semantics
+ in templates.
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@171670 138bc75d-0d04-0410-961f-82ee72b054a4
+
+index 3213483..23bb021 100644
+--- a/gcc/cp/semantics.c
++++ b/gcc/cp/semantics.c
+@@ -2150,11 +2150,14 @@ finish_call_expr (tree fn, VEC(tree,gc) **args, bool disallow_virtual,
+ /* A call where the function is unknown. */
+ result = cp_build_function_call_vec (fn, args, complain);
+
+- if (processing_template_decl)
++ if (processing_template_decl && result != error_mark_node)
+ {
++ if (TREE_CODE (result) == INDIRECT_REF)
++ result = TREE_OPERAND (result, 0);
+ result = build_call_vec (TREE_TYPE (result), orig_fn, orig_args);
+ KOENIG_LOOKUP_P (result) = koenig_p;
+ release_tree_vector (orig_args);
++ result = convert_from_reference (result);
+ }
+
+ return result;
+new file mode 100644
+index 0000000..66630e5
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp0x/auto22.C
+@@ -0,0 +1,21 @@
++// PR c++/47999
++// { dg-options -std=c++0x }
++
++int& identity(int& i)
++{
++ return i;
++}
++
++// In a function template, auto type deduction works incorrectly.
++template <typename = void>
++void f()
++{
++ int i = 0;
++ auto&& x = identity(i); // Type of x should be `int&`, but it is `int&&`.
++}
++
++int main (int argc, char* argv[])
++{
++ f();
++ return 0;
++}
+--
+1.7.0.4
+