diff options
author | Khem Raj <raj.khem@gmail.com> | 2011-04-30 12:37:47 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-05-05 12:26:41 +0100 |
commit | 478deec11f3349d61b1a922f047dc958dc07262a (patch) | |
tree | 1843907b36de2bcb8f821d49d8c9a88014ef0dc7 /meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0034-PR-c-48296.patch | |
parent | d42dccf886983ba14ccc868041d7bea0cf1a260e (diff) | |
download | poky-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/0034-PR-c-48296.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0034-PR-c-48296.patch | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0034-PR-c-48296.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0034-PR-c-48296.patch new file mode 100644 index 0000000000..084a57cb4a --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0034-PR-c-48296.patch | |||
@@ -0,0 +1,102 @@ | |||
1 | From d67703129d516043d4e43bdf79a17889f5abc3f7 Mon Sep 17 00:00:00 2001 | ||
2 | From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | ||
3 | Date: Tue, 29 Mar 2011 14:26:33 +0000 | ||
4 | Subject: [PATCH 034/200] PR c++/48296 | ||
5 | * decl.c (cp_finish_decl): Defer validation of constexpr member | ||
6 | functions. | ||
7 | * class.c (finalize_literal_type_property): Validate them here. | ||
8 | * semantics.c (is_valid_constexpr_fn): Don't check completeness. | ||
9 | |||
10 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@171675 138bc75d-0d04-0410-961f-82ee72b054a4 | ||
11 | |||
12 | index 1325260..42066c3 100644 | ||
13 | --- a/gcc/cp/class.c | ||
14 | +++ b/gcc/cp/class.c | ||
15 | @@ -4547,6 +4547,8 @@ type_requires_array_cookie (tree type) | ||
16 | static void | ||
17 | finalize_literal_type_property (tree t) | ||
18 | { | ||
19 | + tree fn; | ||
20 | + | ||
21 | if (cxx_dialect < cxx0x | ||
22 | || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) | ||
23 | /* FIXME These constraints seem unnecessary; remove from standard. | ||
24 | @@ -4557,18 +4559,10 @@ finalize_literal_type_property (tree t) | ||
25 | && !TYPE_HAS_CONSTEXPR_CTOR (t)) | ||
26 | CLASSTYPE_LITERAL_P (t) = false; | ||
27 | |||
28 | - if (!CLASSTYPE_LITERAL_P (t) && !CLASSTYPE_TEMPLATE_INSTANTIATION (t)) | ||
29 | - { | ||
30 | - tree fn; | ||
31 | - for (fn = TYPE_METHODS (t); fn; fn = DECL_CHAIN (fn)) | ||
32 | - if (DECL_DECLARED_CONSTEXPR_P (fn) | ||
33 | - && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn) | ||
34 | - && !DECL_CONSTRUCTOR_P (fn)) | ||
35 | - { | ||
36 | - error ("enclosing class of %q+D is not a literal type", fn); | ||
37 | - DECL_DECLARED_CONSTEXPR_P (fn) = false; | ||
38 | - } | ||
39 | - } | ||
40 | + for (fn = TYPE_METHODS (t); fn; fn = DECL_CHAIN (fn)) | ||
41 | + if (DECL_DECLARED_CONSTEXPR_P (fn) | ||
42 | + && TREE_CODE (fn) != TEMPLATE_DECL) | ||
43 | + validate_constexpr_fundecl (fn); | ||
44 | } | ||
45 | |||
46 | /* Check the validity of the bases and members declared in T. Add any | ||
47 | diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c | ||
48 | index 3139ad8..fbd6c97 100644 | ||
49 | --- a/gcc/cp/decl.c | ||
50 | +++ b/gcc/cp/decl.c | ||
51 | @@ -5793,7 +5793,10 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p, | ||
52 | } | ||
53 | } | ||
54 | |||
55 | - if (TREE_CODE (decl) == FUNCTION_DECL) | ||
56 | + if (TREE_CODE (decl) == FUNCTION_DECL | ||
57 | + /* For members, defer until finalize_literal_type_property. */ | ||
58 | + && (!DECL_CLASS_SCOPE_P (decl) | ||
59 | + || !TYPE_BEING_DEFINED (DECL_CONTEXT (decl)))) | ||
60 | validate_constexpr_fundecl (decl); | ||
61 | |||
62 | else if (!ensure_literal_type_for_constexpr_object (decl)) | ||
63 | diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c | ||
64 | index a41a1d5..9926d26 100644 | ||
65 | --- a/gcc/cp/semantics.c | ||
66 | +++ b/gcc/cp/semantics.c | ||
67 | @@ -5406,8 +5406,7 @@ is_valid_constexpr_fn (tree fun, bool complain) | ||
68 | } | ||
69 | |||
70 | if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun) | ||
71 | - && COMPLETE_TYPE_P (DECL_CONTEXT (fun)) | ||
72 | - && !valid_type_in_constexpr_fundecl_p (DECL_CONTEXT (fun))) | ||
73 | + && !CLASSTYPE_LITERAL_P (DECL_CONTEXT (fun))) | ||
74 | { | ||
75 | ret = false; | ||
76 | if (complain) | ||
77 | new file mode 100644 | ||
78 | index 0000000..4646f82 | ||
79 | --- /dev/null | ||
80 | +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C | ||
81 | @@ -0,0 +1,18 @@ | ||
82 | +// PR c++/48296 | ||
83 | +// { dg-options -std=c++0x } | ||
84 | + | ||
85 | +struct X | ||
86 | +{ | ||
87 | + constexpr X() { } | ||
88 | + constexpr X f(X x) { return x; } | ||
89 | + constexpr X g(X x); | ||
90 | +}; | ||
91 | + | ||
92 | +constexpr X X::g(X x) { return x; } | ||
93 | + | ||
94 | +struct Y | ||
95 | +{ | ||
96 | + Y() { } | ||
97 | + constexpr Y f(Y y); // { dg-error "constexpr" } | ||
98 | + static constexpr Y g(Y y); // { dg-error "constexpr" } | ||
99 | +}; | ||
100 | -- | ||
101 | 1.7.0.4 | ||
102 | |||