diff options
author | Khem Raj <raj.khem@gmail.com> | 2011-06-12 20:56:57 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-06-14 15:29:15 +0100 |
commit | ec9b6d061b8495b9316ae90e5a71a499ef2873ee (patch) | |
tree | dc922c9ddd98f937eb2095b07f6c3b5043e3a491 /meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0232-PR-c-48089.patch | |
parent | fbc60cc5ba2284bfcaea8c82001a49b7795cc2a2 (diff) | |
download | poky-ec9b6d061b8495b9316ae90e5a71a499ef2873ee.tar.gz |
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
(From OE-Core rev: 3968f33b6542cf20cf63cf49bfbc033bd2486295)
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/0232-PR-c-48089.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0232-PR-c-48089.patch | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0232-PR-c-48089.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0232-PR-c-48089.patch new file mode 100644 index 0000000000..300b4e143e --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0232-PR-c-48089.patch | |||
@@ -0,0 +1,77 @@ | |||
1 | From 3db4aa63d6850f44758d06d5f075c76de6d4c1e9 Mon Sep 17 00:00:00 2001 | ||
2 | From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | ||
3 | Date: Fri, 6 May 2011 21:58:22 +0000 | ||
4 | Subject: [PATCH] PR c++/48089 | ||
5 | * semantics.c (potential_constant_expression_1): Don't allow *this | ||
6 | in a constructor. | ||
7 | (register_constexpr_fundef): Use potential_rvalue_constant_expression. | ||
8 | |||
9 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@173513 138bc75d-0d04-0410-961f-82ee72b054a4 | ||
10 | |||
11 | index f43649e..8f621b9 100644 | ||
12 | --- a/gcc/cp/semantics.c | ||
13 | +++ b/gcc/cp/semantics.c | ||
14 | @@ -5704,11 +5704,11 @@ register_constexpr_fundef (tree fun, tree body) | ||
15 | body = unshare_expr (TREE_OPERAND (body, 0)); | ||
16 | } | ||
17 | |||
18 | - if (!potential_constant_expression (body)) | ||
19 | + if (!potential_rvalue_constant_expression (body)) | ||
20 | { | ||
21 | DECL_DECLARED_CONSTEXPR_P (fun) = false; | ||
22 | if (!DECL_TEMPLATE_INSTANTIATION (fun)) | ||
23 | - require_potential_constant_expression (body); | ||
24 | + require_potential_rvalue_constant_expression (body); | ||
25 | return NULL; | ||
26 | } | ||
27 | fundef->body = body; | ||
28 | @@ -7560,7 +7560,16 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags) | ||
29 | tree x = TREE_OPERAND (t, 0); | ||
30 | STRIP_NOPS (x); | ||
31 | if (is_this_parameter (x)) | ||
32 | - return true; | ||
33 | + { | ||
34 | + if (DECL_CONSTRUCTOR_P (DECL_CONTEXT (x)) && want_rval) | ||
35 | + { | ||
36 | + if (flags & tf_error) | ||
37 | + sorry ("use of the value of the object being constructed " | ||
38 | + "in a constant expression"); | ||
39 | + return false; | ||
40 | + } | ||
41 | + return true; | ||
42 | + } | ||
43 | return potential_constant_expression_1 (x, rval, flags); | ||
44 | } | ||
45 | |||
46 | new file mode 100644 | ||
47 | index 0000000..fc69cfe | ||
48 | --- /dev/null | ||
49 | +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C | ||
50 | @@ -0,0 +1,24 @@ | ||
51 | +// PR c++/48089 | ||
52 | +// { dg-options -std=c++0x } | ||
53 | + | ||
54 | +// bang is ill-formed (diagnostic required) because its initializer is | ||
55 | +// non-constant, because it uses the value of an uninitialized object. | ||
56 | + | ||
57 | +// s() is ill-formed (no diagnostic required) because there is no set of | ||
58 | +// arguments that would produce a constant expression. | ||
59 | + | ||
60 | +// R() is well-formed because i is initialized before j. | ||
61 | + | ||
62 | +struct s { | ||
63 | + constexpr s() : v(v) { } // { dg-message "" } | ||
64 | + int v; | ||
65 | +}; | ||
66 | + | ||
67 | +constexpr s bang; // { dg-error "" } | ||
68 | + | ||
69 | +struct R { | ||
70 | + int i,j; | ||
71 | + constexpr R() : i(42),j(i) { } // { dg-bogus "" "" { xfail *-*-* } } | ||
72 | +}; | ||
73 | + | ||
74 | +constexpr R r; // { dg-bogus "" "" { xfail *-*-* } } | ||
75 | -- | ||
76 | 1.7.0.4 | ||
77 | |||