diff options
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0226-Fix-PR-c-48838.patch')
-rw-r--r-- | meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0226-Fix-PR-c-48838.patch | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0226-Fix-PR-c-48838.patch b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0226-Fix-PR-c-48838.patch new file mode 100644 index 0000000000..af31ff0248 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0226-Fix-PR-c-48838.patch | |||
@@ -0,0 +1,112 @@ | |||
1 | From 01c39e4050b00a6483b1e196b1308beed14d6e4a Mon Sep 17 00:00:00 2001 | ||
2 | From: dodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4> | ||
3 | Date: Fri, 6 May 2011 08:34:10 +0000 | ||
4 | Subject: [PATCH] Fix PR c++/48838 | ||
5 | |||
6 | gcc/cp | ||
7 | |||
8 | PR c++/48838 | ||
9 | * cp-tree.h (non_static_member_function_p): Declare new function. | ||
10 | * tree.c (non_static_member_function_p): Define it. | ||
11 | * semantics.c (finish_call_expr): Use it. | ||
12 | |||
13 | gcc/testsuite | ||
14 | |||
15 | PR c++/48838 | ||
16 | * g++.dg/template/member9.C: New test case. | ||
17 | |||
18 | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@173472 138bc75d-0d04-0410-961f-82ee72b054a4 | ||
19 | |||
20 | index 176a4b8..9fbca57 100644 | ||
21 | --- a/gcc/cp/cp-tree.h | ||
22 | +++ b/gcc/cp/cp-tree.h | ||
23 | @@ -5409,6 +5409,7 @@ extern tree get_fns (tree); | ||
24 | extern tree get_first_fn (tree); | ||
25 | extern tree ovl_cons (tree, tree); | ||
26 | extern tree build_overload (tree, tree); | ||
27 | +extern bool non_static_member_function_p (tree); | ||
28 | extern const char *cxx_printable_name (tree, int); | ||
29 | extern const char *cxx_printable_name_translate (tree, int); | ||
30 | extern tree build_exception_variant (tree, tree); | ||
31 | diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c | ||
32 | index b5c0b80..f43649e 100644 | ||
33 | --- a/gcc/cp/semantics.c | ||
34 | +++ b/gcc/cp/semantics.c | ||
35 | @@ -2041,8 +2041,7 @@ finish_call_expr (tree fn, VEC(tree,gc) **args, bool disallow_virtual, | ||
36 | is not included in *ARGS even though it is considered to | ||
37 | be part of the list of arguments. Note that this is | ||
38 | related to CWG issues 515 and 1005. */ | ||
39 | - || (((TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE) | ||
40 | - || BASELINK_P (fn)) | ||
41 | + || (non_static_member_function_p (fn) | ||
42 | && current_class_ref | ||
43 | && type_dependent_expression_p (current_class_ref))) | ||
44 | { | ||
45 | diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c | ||
46 | index 15ee741..f04fd23 100644 | ||
47 | --- a/gcc/cp/tree.c | ||
48 | +++ b/gcc/cp/tree.c | ||
49 | @@ -1465,6 +1465,34 @@ build_overload (tree decl, tree chain) | ||
50 | return ovl_cons (decl, chain); | ||
51 | } | ||
52 | |||
53 | +/* Return TRUE if FN is a non-static member function, FALSE otherwise. | ||
54 | + This function looks into BASELINK and OVERLOAD nodes. */ | ||
55 | + | ||
56 | +bool | ||
57 | +non_static_member_function_p (tree fn) | ||
58 | +{ | ||
59 | + if (fn == NULL_TREE) | ||
60 | + return false; | ||
61 | + | ||
62 | + if (BASELINK_P (fn)) | ||
63 | + { | ||
64 | + tree type = TREE_TYPE (fn); | ||
65 | + | ||
66 | + if (type && TREE_CODE (type) == METHOD_TYPE) | ||
67 | + return true; | ||
68 | + else if (type && TREE_CODE (type) == FUNCTION_TYPE) | ||
69 | + return false; | ||
70 | + /* This is an overload. Lets look into its current value. */ | ||
71 | + fn = get_fns (BASELINK_FUNCTIONS (fn)); | ||
72 | + } | ||
73 | + | ||
74 | + if (TREE_CODE (fn) == OVERLOAD) | ||
75 | + fn = OVL_CURRENT (fn); | ||
76 | + | ||
77 | + return (DECL_P (fn) | ||
78 | + && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)); | ||
79 | +} | ||
80 | + | ||
81 | |||
82 | #define PRINT_RING_SIZE 4 | ||
83 | |||
84 | new file mode 100644 | ||
85 | index 0000000..f15272d | ||
86 | --- /dev/null | ||
87 | +++ b/gcc/testsuite/g++.dg/template/member9.C | ||
88 | @@ -0,0 +1,21 @@ | ||
89 | +// Origin PR c++/48838 | ||
90 | +// { dg-do compile } | ||
91 | + | ||
92 | +class DUChainItemSystem | ||
93 | +{ | ||
94 | +public: | ||
95 | + | ||
96 | + template<class T> | ||
97 | + void registerTypeClass(); | ||
98 | + | ||
99 | + static DUChainItemSystem& self(); | ||
100 | +}; | ||
101 | + | ||
102 | +template<class T> | ||
103 | +struct DUChainItemRegistrator | ||
104 | +{ | ||
105 | + DUChainItemRegistrator() | ||
106 | + { | ||
107 | + DUChainItemSystem::self().registerTypeClass<T>(); | ||
108 | + } | ||
109 | +}; | ||
110 | -- | ||
111 | 1.7.0.4 | ||
112 | |||