]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/blob
7272d327826477d49923975a3c4e833020bb17a5
[thirdparty/openembedded/openembedded-core-contrib.git] /
1 Upstream-Status: Inappropriate [Backport]
2 From 6ec20c02d4514be339f0112d793794abf60451a7 Mon Sep 17 00:00:00 2001
3 From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
4 Date: Tue, 29 Mar 2011 14:25:51 +0000
5 Subject: [PATCH 030/200] * pt.c (build_non_dependent_expr): Keep dereferences outside the
6 NON_DEPENDENT_EXPR.
7
8 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@171671 138bc75d-0d04-0410-961f-82ee72b054a4
9
10 index 2e18588..d649628 100644
11 --- a/gcc/cp/pt.c
12 +++ b/gcc/cp/pt.c
13 @@ -18851,24 +18851,17 @@ build_non_dependent_expr (tree expr)
14 TREE_OPERAND (expr, 0),
15 build_non_dependent_expr (TREE_OPERAND (expr, 1)));
16
17 + /* Keep dereferences outside the NON_DEPENDENT_EXPR so lvalue_kind
18 + doesn't need to look inside. */
19 + if (TREE_CODE (expr) == INDIRECT_REF && REFERENCE_REF_P (expr))
20 + return convert_from_reference (build_non_dependent_expr
21 + (TREE_OPERAND (expr, 0)));
22 +
23 /* If the type is unknown, it can't really be non-dependent */
24 gcc_assert (TREE_TYPE (expr) != unknown_type_node);
25
26 - /* Otherwise, build a NON_DEPENDENT_EXPR.
27 -
28 - REFERENCE_TYPEs are not stripped for expressions in templates
29 - because doing so would play havoc with mangling. Consider, for
30 - example:
31 -
32 - template <typename T> void f<T& g>() { g(); }
33 -
34 - In the body of "f", the expression for "g" will have
35 - REFERENCE_TYPE, even though the standard says that it should
36 - not. The reason is that we must preserve the syntactic form of
37 - the expression so that mangling (say) "f<g>" inside the body of
38 - "f" works out correctly. Therefore, the REFERENCE_TYPE is
39 - stripped here. */
40 - return build1 (NON_DEPENDENT_EXPR, non_reference (TREE_TYPE (expr)), expr);
41 + /* Otherwise, build a NON_DEPENDENT_EXPR. */
42 + return build1 (NON_DEPENDENT_EXPR, TREE_TYPE (expr), expr);
43 }
44
45 /* ARGS is a vector of expressions as arguments to a function call.
46 new file mode 100644
47 index 0000000..12e363a
48 --- /dev/null
49 +++ b/gcc/testsuite/g++.dg/cpp0x/move1.C
50 @@ -0,0 +1,15 @@
51 +// { dg-options "-std=c++0x -pedantic-errors" }
52 +
53 +#include <utility>
54 +
55 +class A { };
56 +
57 +static void g ( A && ) { }
58 +
59 +template < class T > class B {
60 +public:
61 + void f ( ) {
62 + A a;
63 + g ( std :: move ( a ) );
64 + }
65 +};
66 --
67 1.7.0.4
68