summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0090-PR-c-48500.patch
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2011-04-30 12:37:47 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-05-05 12:26:41 +0100
commit478deec11f3349d61b1a922f047dc958dc07262a (patch)
tree1843907b36de2bcb8f821d49d8c9a88014ef0dc7 /meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0090-PR-c-48500.patch
parentd42dccf886983ba14ccc868041d7bea0cf1a260e (diff)
downloadpoky-478deec11f3349d61b1a922f047dc958dc07262a.tar.gz
gcc-4.6.0: Backport FSF 4.6 branch patches
This is set of bugfixes that has been done on FSF gcc-4_2-branch since 4.6.0 was released They will roll into 4.6.1 release once that happens in coming approx 6 months time then we can simply remove them thats the reason so use a separate .inc file to define the SRC_URI additions (From OE-Core rev: b0d5b9f12adbce2c4a0df6059f5671188cd32293) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0090-PR-c-48500.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0090-PR-c-48500.patch145
1 files changed, 145 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0090-PR-c-48500.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0090-PR-c-48500.patch
new file mode 100644
index 0000000000..74f0afad3b
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0090-PR-c-48500.patch
@@ -0,0 +1,145 @@
1From c9ec81bbd73666b97ab9049b759b5ab8d0e06681 Mon Sep 17 00:00:00 2001
2From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
3Date: Fri, 8 Apr 2011 15:02:28 +0000
4Subject: [PATCH 090/200] PR c++/48500
5 * semantics.c (potential_constant_expression_1) [CALL_EXPR]: Check
6 arguments even if we don't know the function.
7
8git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@172195 138bc75d-0d04-0410-961f-82ee72b054a4
9
10index 3a85ddb..e6bb1dc 100644
11--- a/gcc/cp/semantics.c
12+++ b/gcc/cp/semantics.c
13@@ -7374,6 +7374,8 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
14 class member access expression, including the result of the
15 implicit transformation in the body of the non-static
16 member function (9.3.1); */
17+ /* FIXME this restriction seems pointless since the standard dropped
18+ "potential constant expression". */
19 if (is_this_parameter (t))
20 {
21 if (flags & tf_error)
22@@ -7389,51 +7391,63 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
23 {
24 tree fun = get_function_named_in_call (t);
25 const int nargs = call_expr_nargs (t);
26- if (TREE_CODE (fun) != FUNCTION_DECL)
27- {
28- if (potential_constant_expression_1 (fun, rval, flags))
29- /* Might end up being a constant function pointer. */
30- return true;
31- if (flags & tf_error)
32- error ("%qE is not a function name", fun);
33- return false;
34- }
35- /* Skip initial arguments to base constructors. */
36- if (DECL_BASE_CONSTRUCTOR_P (fun))
37- i = num_artificial_parms_for (fun);
38+ i = 0;
39+
40+ if (is_overloaded_fn (fun))
41+ {
42+ if (TREE_CODE (fun) == FUNCTION_DECL)
43+ {
44+ if (builtin_valid_in_constant_expr_p (fun))
45+ return true;
46+ if (!DECL_DECLARED_CONSTEXPR_P (fun)
47+ && !morally_constexpr_builtin_function_p (fun))
48+ {
49+ if (flags & tf_error)
50+ error ("%qD is not %<constexpr%>", fun);
51+ return false;
52+ }
53+ /* A call to a non-static member function takes the address
54+ of the object as the first argument. But in a constant
55+ expression the address will be folded away, so look
56+ through it now. */
57+ if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun)
58+ && !DECL_CONSTRUCTOR_P (fun))
59+ {
60+ tree x = get_nth_callarg (t, 0);
61+ if (is_this_parameter (x))
62+ /* OK. */;
63+ else if (!potential_constant_expression_1 (x, rval, flags))
64+ {
65+ if (flags & tf_error)
66+ error ("object argument is not a potential "
67+ "constant expression");
68+ return false;
69+ }
70+ i = 1;
71+ }
72+ }
73+ else
74+ fun = get_first_fn (fun);
75+ /* Skip initial arguments to base constructors. */
76+ if (DECL_BASE_CONSTRUCTOR_P (fun))
77+ i = num_artificial_parms_for (fun);
78+ fun = DECL_ORIGIN (fun);
79+ }
80 else
81- i = 0;
82- fun = DECL_ORIGIN (fun);
83- if (builtin_valid_in_constant_expr_p (fun))
84- return true;
85- if (!DECL_DECLARED_CONSTEXPR_P (fun)
86- && !morally_constexpr_builtin_function_p (fun))
87 {
88- if (flags & tf_error)
89- error ("%qD is not %<constexpr%>", fun);
90- return false;
91+ if (potential_constant_expression_1 (fun, rval, flags))
92+ /* Might end up being a constant function pointer. */;
93+ else
94+ {
95+ if (flags & tf_error)
96+ error ("%qE is not a function name", fun);
97+ return false;
98+ }
99 }
100 for (; i < nargs; ++i)
101 {
102 tree x = get_nth_callarg (t, i);
103- /* A call to a non-static member function takes the
104- address of the object as the first argument.
105- But in a constant expression the address will be folded
106- away, so look through it now. */
107- if (i == 0 && DECL_NONSTATIC_MEMBER_P (fun)
108- && !DECL_CONSTRUCTOR_P (fun))
109- {
110- if (is_this_parameter (x))
111- /* OK. */;
112- else if (!potential_constant_expression_1 (x, rval, flags))
113- {
114- if (flags & tf_error)
115- error ("object argument is not a potential constant "
116- "expression");
117- return false;
118- }
119- }
120- else if (!potential_constant_expression_1 (x, rval, flags))
121+ if (!potential_constant_expression_1 (x, rval, flags))
122 {
123 if (flags & tf_error)
124 error ("argument in position %qP is not a "
125new file mode 100644
126index 0000000..833318b
127--- /dev/null
128+++ b/gcc/testsuite/g++.dg/cpp0x/regress/call1.C
129@@ -0,0 +1,13 @@
130+// PR c++/48500
131+// { dg-options -std=c++0x }
132+
133+struct linked_ptr {
134+};
135+template <typename T> linked_ptr make_linked_ptr(T* ptr);
136+struct Concrete;
137+struct NewedClass {
138+ NewedClass(const Concrete& req){}
139+};
140+template<typename ArgT> void AddObjToChange(const ArgT& req) {
141+ linked_ptr p = make_linked_ptr(new NewedClass(req));
142+}
143--
1441.7.0.4
145