Bug Summary

File:build/gcc/vec.h
Warning:line 814, column 10
Called C++ object pointer is null

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name typeck.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model static -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/objdir/gcc -resource-dir /usr/lib64/clang/13.0.0 -D IN_GCC_FRONTEND -D IN_GCC -D HAVE_CONFIG_H -I . -I cp -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../include -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libcpp/include -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libcody -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libdecnumber -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libdecnumber/bid -I ../libdecnumber -I /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/../libbacktrace -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/11/../../../../include/c++/11 -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/11/../../../../include/c++/11/x86_64-suse-linux -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/11/../../../../include/c++/11/backward -internal-isystem /usr/lib64/clang/13.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib64/gcc/x86_64-suse-linux/11/../../../../x86_64-suse-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-narrowing -Wwrite-strings -Wno-error=format-diag -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fdeprecated-macro -fdebug-compilation-dir=/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/objdir/gcc -ferror-limit 19 -fno-rtti -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-output=plist-html -analyzer-config silence-checkers=core.NullDereference -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/objdir/clang-static-analyzer/2021-11-20-133755-20252-1/report-U2Icz6.plist -x c++ /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c

/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c

1/* Build expressions with type checking for C++ compiler.
2 Copyright (C) 1987-2021 Free Software Foundation, Inc.
3 Hacked by Michael Tiemann (tiemann@cygnus.com)
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21
22/* This file is part of the C++ front end.
23 It contains routines to build C++ expressions given their operands,
24 including computing the types of the result, C and C++ specific error
25 checks, and some optimization. */
26
27#include "config.h"
28#include "system.h"
29#include "coretypes.h"
30#include "target.h"
31#include "cp-tree.h"
32#include "stor-layout.h"
33#include "varasm.h"
34#include "intl.h"
35#include "convert.h"
36#include "c-family/c-objc.h"
37#include "c-family/c-ubsan.h"
38#include "gcc-rich-location.h"
39#include "stringpool.h"
40#include "attribs.h"
41#include "asan.h"
42#include "gimplify.h"
43
44static tree cp_build_addr_expr_strict (tree, tsubst_flags_t);
45static tree cp_build_function_call (tree, tree, tsubst_flags_t);
46static tree pfn_from_ptrmemfunc (tree);
47static tree delta_from_ptrmemfunc (tree);
48static tree convert_for_assignment (tree, tree, impl_conv_rhs, tree, int,
49 tsubst_flags_t, int);
50static tree cp_pointer_int_sum (location_t, enum tree_code, tree, tree,
51 tsubst_flags_t);
52static tree rationalize_conditional_expr (enum tree_code, tree,
53 tsubst_flags_t);
54static bool comp_ptr_ttypes_real (tree, tree, int);
55static bool comp_except_types (tree, tree, bool);
56static bool comp_array_types (const_tree, const_tree, compare_bounds_t, bool);
57static tree pointer_diff (location_t, tree, tree, tree, tsubst_flags_t, tree *);
58static tree get_delta_difference (tree, tree, bool, bool, tsubst_flags_t);
59static void casts_away_constness_r (tree *, tree *, tsubst_flags_t);
60static bool casts_away_constness (tree, tree, tsubst_flags_t);
61static bool maybe_warn_about_returning_address_of_local (tree, location_t = UNKNOWN_LOCATION((location_t) 0));
62static void error_args_num (location_t, tree, bool);
63static int convert_arguments (tree, vec<tree, va_gc> **, tree, int,
64 tsubst_flags_t);
65static bool is_std_move_p (tree);
66static bool is_std_forward_p (tree);
67
68/* Do `exp = require_complete_type (exp);' to make sure exp
69 does not have an incomplete type. (That includes void types.)
70 Returns error_mark_node if the VALUE does not have
71 complete type when this function returns. */
72
73tree
74require_complete_type_sfinae (tree value, tsubst_flags_t complain)
75{
76 tree type;
77
78 if (processing_template_declscope_chain->x_processing_template_decl || value == error_mark_nodeglobal_trees[TI_ERROR_MARK])
79 return value;
80
81 if (TREE_CODE (value)((enum tree_code) (value)->base.code) == OVERLOAD)
82 type = unknown_type_nodecp_global_trees[CPTI_UNKNOWN_TYPE];
83 else
84 type = TREE_TYPE (value)((contains_struct_check ((value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 84, __FUNCTION__))->typed.type)
;
85
86 if (type == error_mark_nodeglobal_trees[TI_ERROR_MARK])
87 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
88
89 /* First, detect a valid value with a complete type. */
90 if (COMPLETE_TYPE_P (type)(((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 90, __FUNCTION__))->type_common.size) != (tree) __null)
)
91 return value;
92
93 if (complete_type_or_maybe_complain (type, value, complain))
94 return value;
95 else
96 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
97}
98
99tree
100require_complete_type (tree value)
101{
102 return require_complete_type_sfinae (value, tf_warning_or_error);
103}
104
105/* Try to complete TYPE, if it is incomplete. For example, if TYPE is
106 a template instantiation, do the instantiation. Returns TYPE,
107 whether or not it could be completed, unless something goes
108 horribly wrong, in which case the error_mark_node is returned. */
109
110tree
111complete_type (tree type)
112{
113 if (type == NULL_TREE(tree) __null)
114 /* Rather than crash, we return something sure to cause an error
115 at some point. */
116 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
117
118 if (type == error_mark_nodeglobal_trees[TI_ERROR_MARK] || COMPLETE_TYPE_P (type)(((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 118, __FUNCTION__))->type_common.size) != (tree) __null)
)
119 ;
120 else if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ARRAY_TYPE)
121 {
122 tree t = complete_type (TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 122, __FUNCTION__))->typed.type)
);
123 unsigned int needs_constructing, has_nontrivial_dtor;
124 if (COMPLETE_TYPE_P (t)(((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 124, __FUNCTION__))->type_common.size) != (tree) __null)
&& !dependent_type_p (type))
125 layout_type (type);
126 needs_constructing
127 = TYPE_NEEDS_CONSTRUCTING (TYPE_MAIN_VARIANT (t))((tree_class_check ((((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 127, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 127, __FUNCTION__))->type_common.needs_constructing_flag
)
;
128 has_nontrivial_dtor
129 = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (TYPE_MAIN_VARIANT (t))(((tree_class_check ((((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 129, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 129, __FUNCTION__))->type_common.lang_flag_4))
;
130 for (t = TYPE_MAIN_VARIANT (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 130, __FUNCTION__))->type_common.main_variant)
; t; t = TYPE_NEXT_VARIANT (t)((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 130, __FUNCTION__))->type_common.next_variant)
)
131 {
132 TYPE_NEEDS_CONSTRUCTING (t)((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 132, __FUNCTION__))->type_common.needs_constructing_flag
)
= needs_constructing;
133 TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)(((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 133, __FUNCTION__))->type_common.lang_flag_4))
= has_nontrivial_dtor;
134 }
135 }
136 else if (CLASS_TYPE_P (type)(((((enum tree_code) (type)->base.code)) == RECORD_TYPE ||
(((enum tree_code) (type)->base.code)) == UNION_TYPE) &&
((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 136, __FUNCTION__))->type_common.lang_flag_5))
)
137 {
138 if (modules_p ())
139 /* TYPE could be a class member we've not loaded the definition of. */
140 lazy_load_pendings (TYPE_NAME (TYPE_MAIN_VARIANT (type))((tree_class_check ((((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 140, __FUNCTION__))->type_common.main_variant)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 140, __FUNCTION__))->type_common.name)
);
141
142 if (CLASSTYPE_TEMPLATE_INSTANTIATION (type)(((((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 142, __FUNCTION__))->type_with_lang_specific.lang_specific
))->use_template) & 1)
)
143 instantiate_class_template (TYPE_MAIN_VARIANT (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 143, __FUNCTION__))->type_common.main_variant)
);
144 }
145
146 return type;
147}
148
149/* Like complete_type, but issue an error if the TYPE cannot be completed.
150 VALUE is used for informative diagnostics.
151 Returns NULL_TREE if the type cannot be made complete. */
152
153tree
154complete_type_or_maybe_complain (tree type, tree value, tsubst_flags_t complain)
155{
156 type = complete_type (type);
157 if (type == error_mark_nodeglobal_trees[TI_ERROR_MARK])
158 /* We already issued an error. */
159 return NULL_TREE(tree) __null;
160 else if (!COMPLETE_TYPE_P (type)(((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 160, __FUNCTION__))->type_common.size) != (tree) __null)
)
161 {
162 if (complain & tf_error)
163 cxx_incomplete_type_diagnostic (value, type, DK_ERROR);
164 note_failed_type_completion_for_satisfaction (type);
165 return NULL_TREE(tree) __null;
166 }
167 else
168 return type;
169}
170
171tree
172complete_type_or_else (tree type, tree value)
173{
174 return complete_type_or_maybe_complain (type, value, tf_warning_or_error);
175}
176
177
178/* Return the common type of two parameter lists.
179 We assume that comptypes has already been done and returned 1;
180 if that isn't so, this may crash.
181
182 As an optimization, free the space we allocate if the parameter
183 lists are already common. */
184
185static tree
186commonparms (tree p1, tree p2)
187{
188 tree oldargs = p1, newargs, n;
189 int i, len;
190 int any_change = 0;
191
192 len = list_length (p1);
193 newargs = tree_last (p1);
194
195 if (newargs == void_list_nodeglobal_trees[TI_VOID_LIST_NODE])
196 i = 1;
197 else
198 {
199 i = 0;
200 newargs = 0;
201 }
202
203 for (; i < len; i++)
204 newargs = tree_cons (NULL_TREE(tree) __null, NULL_TREE(tree) __null, newargs);
205
206 n = newargs;
207
208 for (i = 0; p1;
209 p1 = TREE_CHAIN (p1)((contains_struct_check ((p1), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 209, __FUNCTION__))->common.chain)
, p2 = TREE_CHAIN (p2)((contains_struct_check ((p2), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 209, __FUNCTION__))->common.chain)
, n = TREE_CHAIN (n)((contains_struct_check ((n), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 209, __FUNCTION__))->common.chain)
, i++)
210 {
211 if (TREE_PURPOSE (p1)((tree_check ((p1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 211, __FUNCTION__, (TREE_LIST)))->list.purpose)
&& !TREE_PURPOSE (p2)((tree_check ((p2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 211, __FUNCTION__, (TREE_LIST)))->list.purpose)
)
212 {
213 TREE_PURPOSE (n)((tree_check ((n), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 213, __FUNCTION__, (TREE_LIST)))->list.purpose)
= TREE_PURPOSE (p1)((tree_check ((p1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 213, __FUNCTION__, (TREE_LIST)))->list.purpose)
;
214 any_change = 1;
215 }
216 else if (! TREE_PURPOSE (p1)((tree_check ((p1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 216, __FUNCTION__, (TREE_LIST)))->list.purpose)
)
217 {
218 if (TREE_PURPOSE (p2)((tree_check ((p2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 218, __FUNCTION__, (TREE_LIST)))->list.purpose)
)
219 {
220 TREE_PURPOSE (n)((tree_check ((n), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 220, __FUNCTION__, (TREE_LIST)))->list.purpose)
= TREE_PURPOSE (p2)((tree_check ((p2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 220, __FUNCTION__, (TREE_LIST)))->list.purpose)
;
221 any_change = 1;
222 }
223 }
224 else
225 {
226 if (simple_cst_equal (TREE_PURPOSE (p1)((tree_check ((p1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 226, __FUNCTION__, (TREE_LIST)))->list.purpose)
, TREE_PURPOSE (p2)((tree_check ((p2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 226, __FUNCTION__, (TREE_LIST)))->list.purpose)
) != 1)
227 any_change = 1;
228 TREE_PURPOSE (n)((tree_check ((n), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 228, __FUNCTION__, (TREE_LIST)))->list.purpose)
= TREE_PURPOSE (p2)((tree_check ((p2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 228, __FUNCTION__, (TREE_LIST)))->list.purpose)
;
229 }
230 if (TREE_VALUE (p1)((tree_check ((p1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 230, __FUNCTION__, (TREE_LIST)))->list.value)
!= TREE_VALUE (p2)((tree_check ((p2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 230, __FUNCTION__, (TREE_LIST)))->list.value)
)
231 {
232 any_change = 1;
233 TREE_VALUE (n)((tree_check ((n), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 233, __FUNCTION__, (TREE_LIST)))->list.value)
= merge_types (TREE_VALUE (p1)((tree_check ((p1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 233, __FUNCTION__, (TREE_LIST)))->list.value)
, TREE_VALUE (p2)((tree_check ((p2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 233, __FUNCTION__, (TREE_LIST)))->list.value)
);
234 }
235 else
236 TREE_VALUE (n)((tree_check ((n), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 236, __FUNCTION__, (TREE_LIST)))->list.value)
= TREE_VALUE (p1)((tree_check ((p1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 236, __FUNCTION__, (TREE_LIST)))->list.value)
;
237 }
238 if (! any_change)
239 return oldargs;
240
241 return newargs;
242}
243
244/* Given a type, perhaps copied for a typedef,
245 find the "original" version of it. */
246static tree
247original_type (tree t)
248{
249 int quals = cp_type_quals (t);
250 while (t != error_mark_nodeglobal_trees[TI_ERROR_MARK]
251 && TYPE_NAME (t)((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 251, __FUNCTION__))->type_common.name)
!= NULL_TREE(tree) __null)
252 {
253 tree x = TYPE_NAME (t)((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 253, __FUNCTION__))->type_common.name)
;
254 if (TREE_CODE (x)((enum tree_code) (x)->base.code) != TYPE_DECL)
255 break;
256 x = DECL_ORIGINAL_TYPE (x)((tree_check ((x), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 256, __FUNCTION__, (TYPE_DECL)))->decl_non_common.result
)
;
257 if (x == NULL_TREE(tree) __null)
258 break;
259 t = x;
260 }
261 return cp_build_qualified_type (t, quals)cp_build_qualified_type_real ((t), (quals), tf_warning_or_error
)
;
262}
263
264/* Merge the attributes of type OTHER_TYPE into the attributes of type TYPE
265 and return a variant of TYPE with the merged attributes. */
266
267static tree
268merge_type_attributes_from (tree type, tree other_type)
269{
270 tree attrs = targetm.merge_type_attributes (type, other_type);
271 attrs = restrict_type_identity_attributes_to (attrs, TYPE_ATTRIBUTES (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 271, __FUNCTION__))->type_common.attributes)
);
272 return cp_build_type_attribute_variant (type, attrs);
273}
274
275/* Return the common type for two arithmetic types T1 and T2 under the
276 usual arithmetic conversions. The default conversions have already
277 been applied, and enumerated types converted to their compatible
278 integer types. */
279
280static tree
281cp_common_type (tree t1, tree t2)
282{
283 enum tree_code code1 = TREE_CODE (t1)((enum tree_code) (t1)->base.code);
284 enum tree_code code2 = TREE_CODE (t2)((enum tree_code) (t2)->base.code);
285 tree attributes;
286 int i;
287
288
289 /* In what follows, we slightly generalize the rules given in [expr] so
290 as to deal with `long long' and `complex'. First, merge the
291 attributes. */
292 attributes = (*targetm.merge_type_attributes) (t1, t2);
293
294 if (SCOPED_ENUM_P (t1)(((enum tree_code) (t1)->base.code) == ENUMERAL_TYPE &&
((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 294, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag))
|| SCOPED_ENUM_P (t2)(((enum tree_code) (t2)->base.code) == ENUMERAL_TYPE &&
((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 294, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag))
)
295 {
296 if (TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 296, __FUNCTION__))->type_common.main_variant)
== TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 296, __FUNCTION__))->type_common.main_variant)
)
297 return build_type_attribute_variant (t1, attributes);
298 else
299 return NULL_TREE(tree) __null;
300 }
301
302 /* FIXME: Attributes. */
303 gcc_assert (ARITHMETIC_TYPE_P (t1)((void)(!(((((enum tree_code) (t1)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (t1)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (t1)->base.code) == REAL_TYPE || ((enum
tree_code) (t1)->base.code) == COMPLEX_TYPE) || (((enum tree_code
) (t1)->base.code) == VECTOR_TYPE) || (((enum tree_code) (
t1)->base.code) == ENUMERAL_TYPE && !((tree_check (
(t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 305, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag))
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 305, __FUNCTION__), 0 : 0))
304 || VECTOR_TYPE_P (t1)((void)(!(((((enum tree_code) (t1)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (t1)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (t1)->base.code) == REAL_TYPE || ((enum
tree_code) (t1)->base.code) == COMPLEX_TYPE) || (((enum tree_code
) (t1)->base.code) == VECTOR_TYPE) || (((enum tree_code) (
t1)->base.code) == ENUMERAL_TYPE && !((tree_check (
(t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 305, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag))
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 305, __FUNCTION__), 0 : 0))
305 || UNSCOPED_ENUM_P (t1))((void)(!(((((enum tree_code) (t1)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (t1)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (t1)->base.code) == REAL_TYPE || ((enum
tree_code) (t1)->base.code) == COMPLEX_TYPE) || (((enum tree_code
) (t1)->base.code) == VECTOR_TYPE) || (((enum tree_code) (
t1)->base.code) == ENUMERAL_TYPE && !((tree_check (
(t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 305, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag))
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 305, __FUNCTION__), 0 : 0))
;
306 gcc_assert (ARITHMETIC_TYPE_P (t2)((void)(!(((((enum tree_code) (t2)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (t2)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (t2)->base.code) == REAL_TYPE || ((enum
tree_code) (t2)->base.code) == COMPLEX_TYPE) || (((enum tree_code
) (t2)->base.code) == VECTOR_TYPE) || (((enum tree_code) (
t2)->base.code) == ENUMERAL_TYPE && !((tree_check (
(t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 308, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag))
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 308, __FUNCTION__), 0 : 0))
307 || VECTOR_TYPE_P (t2)((void)(!(((((enum tree_code) (t2)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (t2)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (t2)->base.code) == REAL_TYPE || ((enum
tree_code) (t2)->base.code) == COMPLEX_TYPE) || (((enum tree_code
) (t2)->base.code) == VECTOR_TYPE) || (((enum tree_code) (
t2)->base.code) == ENUMERAL_TYPE && !((tree_check (
(t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 308, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag))
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 308, __FUNCTION__), 0 : 0))
308 || UNSCOPED_ENUM_P (t2))((void)(!(((((enum tree_code) (t2)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (t2)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (t2)->base.code) == REAL_TYPE || ((enum
tree_code) (t2)->base.code) == COMPLEX_TYPE) || (((enum tree_code
) (t2)->base.code) == VECTOR_TYPE) || (((enum tree_code) (
t2)->base.code) == ENUMERAL_TYPE && !((tree_check (
(t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 308, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag))
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 308, __FUNCTION__), 0 : 0))
;
309
310 /* If one type is complex, form the common type of the non-complex
311 components, then make that complex. Use T1 or T2 if it is the
312 required type. */
313 if (code1 == COMPLEX_TYPE || code2 == COMPLEX_TYPE)
314 {
315 tree subtype1 = code1 == COMPLEX_TYPE ? TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 315, __FUNCTION__))->typed.type)
: t1;
316 tree subtype2 = code2 == COMPLEX_TYPE ? TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 316, __FUNCTION__))->typed.type)
: t2;
317 tree subtype
318 = type_after_usual_arithmetic_conversions (subtype1, subtype2);
319
320 if (code1 == COMPLEX_TYPE && TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 320, __FUNCTION__))->typed.type)
== subtype)
321 return build_type_attribute_variant (t1, attributes);
322 else if (code2 == COMPLEX_TYPE && TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 322, __FUNCTION__))->typed.type)
== subtype)
323 return build_type_attribute_variant (t2, attributes);
324 else
325 return build_type_attribute_variant (build_complex_type (subtype),
326 attributes);
327 }
328
329 if (code1 == VECTOR_TYPE)
330 {
331 /* When we get here we should have two vectors of the same size.
332 Just prefer the unsigned one if present. */
333 if (TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 333, __FUNCTION__))->base.u.bits.unsigned_flag)
)
334 return merge_type_attributes_from (t1, t2);
335 else
336 return merge_type_attributes_from (t2, t1);
337 }
338
339 /* If only one is real, use it as the result. */
340 if (code1 == REAL_TYPE && code2 != REAL_TYPE)
341 return build_type_attribute_variant (t1, attributes);
342 if (code2 == REAL_TYPE && code1 != REAL_TYPE)
343 return build_type_attribute_variant (t2, attributes);
344
345 /* Both real or both integers; use the one with greater precision. */
346 if (TYPE_PRECISION (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 346, __FUNCTION__))->type_common.precision)
> TYPE_PRECISION (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 346, __FUNCTION__))->type_common.precision)
)
347 return build_type_attribute_variant (t1, attributes);
348 else if (TYPE_PRECISION (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 348, __FUNCTION__))->type_common.precision)
> TYPE_PRECISION (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 348, __FUNCTION__))->type_common.precision)
)
349 return build_type_attribute_variant (t2, attributes);
350
351 /* The types are the same; no need to do anything fancy. */
352 if (TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 352, __FUNCTION__))->type_common.main_variant)
== TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 352, __FUNCTION__))->type_common.main_variant)
)
353 return build_type_attribute_variant (t1, attributes);
354
355 if (code1 != REAL_TYPE)
356 {
357 /* If one is unsigned long long, then convert the other to unsigned
358 long long. */
359 if (same_type_p (TYPE_MAIN_VARIANT (t1), long_long_unsigned_type_node)comptypes ((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 359, __FUNCTION__))->type_common.main_variant)), (integer_types
[itk_unsigned_long_long]), 0)
360 || same_type_p (TYPE_MAIN_VARIANT (t2), long_long_unsigned_type_node)comptypes ((((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 360, __FUNCTION__))->type_common.main_variant)), (integer_types
[itk_unsigned_long_long]), 0)
)
361 return build_type_attribute_variant (long_long_unsigned_type_nodeinteger_types[itk_unsigned_long_long],
362 attributes);
363 /* If one is a long long, and the other is an unsigned long, and
364 long long can represent all the values of an unsigned long, then
365 convert to a long long. Otherwise, convert to an unsigned long
366 long. Otherwise, if either operand is long long, convert the
367 other to long long.
368
369 Since we're here, we know the TYPE_PRECISION is the same;
370 therefore converting to long long cannot represent all the values
371 of an unsigned long, so we choose unsigned long long in that
372 case. */
373 if (same_type_p (TYPE_MAIN_VARIANT (t1), long_long_integer_type_node)comptypes ((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 373, __FUNCTION__))->type_common.main_variant)), (integer_types
[itk_long_long]), 0)
374 || same_type_p (TYPE_MAIN_VARIANT (t2), long_long_integer_type_node)comptypes ((((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 374, __FUNCTION__))->type_common.main_variant)), (integer_types
[itk_long_long]), 0)
)
375 {
376 tree t = ((TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 376, __FUNCTION__))->base.u.bits.unsigned_flag)
|| TYPE_UNSIGNED (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 376, __FUNCTION__))->base.u.bits.unsigned_flag)
)
377 ? long_long_unsigned_type_nodeinteger_types[itk_unsigned_long_long]
378 : long_long_integer_type_nodeinteger_types[itk_long_long]);
379 return build_type_attribute_variant (t, attributes);
380 }
381
382 /* Go through the same procedure, but for longs. */
383 if (same_type_p (TYPE_MAIN_VARIANT (t1), long_unsigned_type_node)comptypes ((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 383, __FUNCTION__))->type_common.main_variant)), (integer_types
[itk_unsigned_long]), 0)
384 || same_type_p (TYPE_MAIN_VARIANT (t2), long_unsigned_type_node)comptypes ((((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 384, __FUNCTION__))->type_common.main_variant)), (integer_types
[itk_unsigned_long]), 0)
)
385 return build_type_attribute_variant (long_unsigned_type_nodeinteger_types[itk_unsigned_long],
386 attributes);
387 if (same_type_p (TYPE_MAIN_VARIANT (t1), long_integer_type_node)comptypes ((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 387, __FUNCTION__))->type_common.main_variant)), (integer_types
[itk_long]), 0)
388 || same_type_p (TYPE_MAIN_VARIANT (t2), long_integer_type_node)comptypes ((((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 388, __FUNCTION__))->type_common.main_variant)), (integer_types
[itk_long]), 0)
)
389 {
390 tree t = ((TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 390, __FUNCTION__))->base.u.bits.unsigned_flag)
|| TYPE_UNSIGNED (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 390, __FUNCTION__))->base.u.bits.unsigned_flag)
)
391 ? long_unsigned_type_nodeinteger_types[itk_unsigned_long] : long_integer_type_nodeinteger_types[itk_long]);
392 return build_type_attribute_variant (t, attributes);
393 }
394
395 /* For __intN types, either the type is __int128 (and is lower
396 priority than the types checked above, but higher than other
397 128-bit types) or it's known to not be the same size as other
398 types (enforced in toplev.c). Prefer the unsigned type. */
399 for (i = 0; i < NUM_INT_N_ENTS1; i ++)
400 {
401 if (int_n_enabled_p [i]
402 && (same_type_p (TYPE_MAIN_VARIANT (t1), int_n_trees[i].signed_type)comptypes ((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 402, __FUNCTION__))->type_common.main_variant)), (int_n_trees
[i].signed_type), 0)
403 || same_type_p (TYPE_MAIN_VARIANT (t2), int_n_trees[i].signed_type)comptypes ((((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 403, __FUNCTION__))->type_common.main_variant)), (int_n_trees
[i].signed_type), 0)
404 || same_type_p (TYPE_MAIN_VARIANT (t1), int_n_trees[i].unsigned_type)comptypes ((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 404, __FUNCTION__))->type_common.main_variant)), (int_n_trees
[i].unsigned_type), 0)
405 || same_type_p (TYPE_MAIN_VARIANT (t2), int_n_trees[i].unsigned_type)comptypes ((((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 405, __FUNCTION__))->type_common.main_variant)), (int_n_trees
[i].unsigned_type), 0)
))
406 {
407 tree t = ((TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 407, __FUNCTION__))->base.u.bits.unsigned_flag)
|| TYPE_UNSIGNED (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 407, __FUNCTION__))->base.u.bits.unsigned_flag)
)
408 ? int_n_trees[i].unsigned_type
409 : int_n_trees[i].signed_type);
410 return build_type_attribute_variant (t, attributes);
411 }
412 }
413
414 /* Otherwise prefer the unsigned one. */
415 if (TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 415, __FUNCTION__))->base.u.bits.unsigned_flag)
)
416 return build_type_attribute_variant (t1, attributes);
417 else
418 return build_type_attribute_variant (t2, attributes);
419 }
420 else
421 {
422 if (same_type_p (TYPE_MAIN_VARIANT (t1), long_double_type_node)comptypes ((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 422, __FUNCTION__))->type_common.main_variant)), (global_trees
[TI_LONG_DOUBLE_TYPE]), 0)
423 || same_type_p (TYPE_MAIN_VARIANT (t2), long_double_type_node)comptypes ((((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 423, __FUNCTION__))->type_common.main_variant)), (global_trees
[TI_LONG_DOUBLE_TYPE]), 0)
)
424 return build_type_attribute_variant (long_double_type_nodeglobal_trees[TI_LONG_DOUBLE_TYPE],
425 attributes);
426 if (same_type_p (TYPE_MAIN_VARIANT (t1), double_type_node)comptypes ((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 426, __FUNCTION__))->type_common.main_variant)), (global_trees
[TI_DOUBLE_TYPE]), 0)
427 || same_type_p (TYPE_MAIN_VARIANT (t2), double_type_node)comptypes ((((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 427, __FUNCTION__))->type_common.main_variant)), (global_trees
[TI_DOUBLE_TYPE]), 0)
)
428 return build_type_attribute_variant (double_type_nodeglobal_trees[TI_DOUBLE_TYPE],
429 attributes);
430 if (same_type_p (TYPE_MAIN_VARIANT (t1), float_type_node)comptypes ((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 430, __FUNCTION__))->type_common.main_variant)), (global_trees
[TI_FLOAT_TYPE]), 0)
431 || same_type_p (TYPE_MAIN_VARIANT (t2), float_type_node)comptypes ((((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 431, __FUNCTION__))->type_common.main_variant)), (global_trees
[TI_FLOAT_TYPE]), 0)
)
432 return build_type_attribute_variant (float_type_nodeglobal_trees[TI_FLOAT_TYPE],
433 attributes);
434
435 /* Two floating-point types whose TYPE_MAIN_VARIANTs are none of
436 the standard C++ floating-point types. Logic earlier in this
437 function has already eliminated the possibility that
438 TYPE_PRECISION (t2) != TYPE_PRECISION (t1), so there's no
439 compelling reason to choose one or the other. */
440 return build_type_attribute_variant (t1, attributes);
441 }
442}
443
444/* T1 and T2 are arithmetic or enumeration types. Return the type
445 that will result from the "usual arithmetic conversions" on T1 and
446 T2 as described in [expr]. */
447
448tree
449type_after_usual_arithmetic_conversions (tree t1, tree t2)
450{
451 gcc_assert (ARITHMETIC_TYPE_P (t1)((void)(!(((((enum tree_code) (t1)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (t1)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (t1)->base.code) == REAL_TYPE || ((enum
tree_code) (t1)->base.code) == COMPLEX_TYPE) || (((enum tree_code
) (t1)->base.code) == VECTOR_TYPE) || (((enum tree_code) (
t1)->base.code) == ENUMERAL_TYPE && !((tree_check (
(t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 453, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag))
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 453, __FUNCTION__), 0 : 0))
452 || VECTOR_TYPE_P (t1)((void)(!(((((enum tree_code) (t1)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (t1)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (t1)->base.code) == REAL_TYPE || ((enum
tree_code) (t1)->base.code) == COMPLEX_TYPE) || (((enum tree_code
) (t1)->base.code) == VECTOR_TYPE) || (((enum tree_code) (
t1)->base.code) == ENUMERAL_TYPE && !((tree_check (
(t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 453, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag))
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 453, __FUNCTION__), 0 : 0))
453 || UNSCOPED_ENUM_P (t1))((void)(!(((((enum tree_code) (t1)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (t1)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (t1)->base.code) == REAL_TYPE || ((enum
tree_code) (t1)->base.code) == COMPLEX_TYPE) || (((enum tree_code
) (t1)->base.code) == VECTOR_TYPE) || (((enum tree_code) (
t1)->base.code) == ENUMERAL_TYPE && !((tree_check (
(t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 453, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag))
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 453, __FUNCTION__), 0 : 0))
;
454 gcc_assert (ARITHMETIC_TYPE_P (t2)((void)(!(((((enum tree_code) (t2)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (t2)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (t2)->base.code) == REAL_TYPE || ((enum
tree_code) (t2)->base.code) == COMPLEX_TYPE) || (((enum tree_code
) (t2)->base.code) == VECTOR_TYPE) || (((enum tree_code) (
t2)->base.code) == ENUMERAL_TYPE && !((tree_check (
(t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 456, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag))
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 456, __FUNCTION__), 0 : 0))
455 || VECTOR_TYPE_P (t2)((void)(!(((((enum tree_code) (t2)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (t2)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (t2)->base.code) == REAL_TYPE || ((enum
tree_code) (t2)->base.code) == COMPLEX_TYPE) || (((enum tree_code
) (t2)->base.code) == VECTOR_TYPE) || (((enum tree_code) (
t2)->base.code) == ENUMERAL_TYPE && !((tree_check (
(t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 456, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag))
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 456, __FUNCTION__), 0 : 0))
456 || UNSCOPED_ENUM_P (t2))((void)(!(((((enum tree_code) (t2)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (t2)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (t2)->base.code) == REAL_TYPE || ((enum
tree_code) (t2)->base.code) == COMPLEX_TYPE) || (((enum tree_code
) (t2)->base.code) == VECTOR_TYPE) || (((enum tree_code) (
t2)->base.code) == ENUMERAL_TYPE && !((tree_check (
(t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 456, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag))
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 456, __FUNCTION__), 0 : 0))
;
457
458 /* Perform the integral promotions. We do not promote real types here. */
459 if (INTEGRAL_OR_ENUMERATION_TYPE_P (t1)(((enum tree_code) (t1)->base.code) == ENUMERAL_TYPE || ((
(enum tree_code) (t1)->base.code) == BOOLEAN_TYPE || ((enum
tree_code) (t1)->base.code) == INTEGER_TYPE))
460 && INTEGRAL_OR_ENUMERATION_TYPE_P (t2)(((enum tree_code) (t2)->base.code) == ENUMERAL_TYPE || ((
(enum tree_code) (t2)->base.code) == BOOLEAN_TYPE || ((enum
tree_code) (t2)->base.code) == INTEGER_TYPE))
)
461 {
462 t1 = type_promotes_to (t1);
463 t2 = type_promotes_to (t2);
464 }
465
466 return cp_common_type (t1, t2);
467}
468
469static void
470composite_pointer_error (const op_location_t &location,
471 diagnostic_t kind, tree t1, tree t2,
472 composite_pointer_operation operation)
473{
474 switch (operation)
475 {
476 case CPO_COMPARISON:
477 emit_diagnostic (kind, location, 0,
478 "comparison between "
479 "distinct pointer types %qT and %qT lacks a cast",
480 t1, t2);
481 break;
482 case CPO_CONVERSION:
483 emit_diagnostic (kind, location, 0,
484 "conversion between "
485 "distinct pointer types %qT and %qT lacks a cast",
486 t1, t2);
487 break;
488 case CPO_CONDITIONAL_EXPR:
489 emit_diagnostic (kind, location, 0,
490 "conditional expression between "
491 "distinct pointer types %qT and %qT lacks a cast",
492 t1, t2);
493 break;
494 default:
495 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 495, __FUNCTION__))
;
496 }
497}
498
499/* Subroutine of composite_pointer_type to implement the recursive
500 case. See that function for documentation of the parameters. And ADD_CONST
501 is used to track adding "const" where needed. */
502
503static tree
504composite_pointer_type_r (const op_location_t &location,
505 tree t1, tree t2, bool *add_const,
506 composite_pointer_operation operation,
507 tsubst_flags_t complain)
508{
509 tree pointee1;
510 tree pointee2;
511 tree result_type;
512 tree attributes;
513
514 /* Determine the types pointed to by T1 and T2. */
515 if (TYPE_PTR_P (t1)(((enum tree_code) (t1)->base.code) == POINTER_TYPE))
516 {
517 pointee1 = TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 517, __FUNCTION__))->typed.type)
;
518 pointee2 = TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 518, __FUNCTION__))->typed.type)
;
519 }
520 else
521 {
522 pointee1 = TYPE_PTRMEM_POINTED_TO_TYPE (t1)((((enum tree_code) (t1)->base.code) == OFFSET_TYPE) ? ((contains_struct_check
((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 522, __FUNCTION__))->typed.type) : ((contains_struct_check
(((cp_build_qualified_type_real ((((contains_struct_check ((
((tree_check3 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 522, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 522, __FUNCTION__))->typed.type)), (cp_type_quals (t1)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 522, __FUNCTION__))->typed.type))
;
523 pointee2 = TYPE_PTRMEM_POINTED_TO_TYPE (t2)((((enum tree_code) (t2)->base.code) == OFFSET_TYPE) ? ((contains_struct_check
((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 523, __FUNCTION__))->typed.type) : ((contains_struct_check
(((cp_build_qualified_type_real ((((contains_struct_check ((
((tree_check3 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 523, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 523, __FUNCTION__))->typed.type)), (cp_type_quals (t2)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 523, __FUNCTION__))->typed.type))
;
524 }
525
526 /* [expr.type]
527
528 If T1 and T2 are similar types, the result is the cv-combined type of
529 T1 and T2. */
530 if (same_type_ignoring_top_level_qualifiers_p (pointee1, pointee2))
531 result_type = pointee1;
532 else if ((TYPE_PTR_P (pointee1)(((enum tree_code) (pointee1)->base.code) == POINTER_TYPE) && TYPE_PTR_P (pointee2)(((enum tree_code) (pointee2)->base.code) == POINTER_TYPE))
533 || (TYPE_PTRMEM_P (pointee1)((((enum tree_code) (pointee1)->base.code) == OFFSET_TYPE)
|| (((enum tree_code) (pointee1)->base.code) == RECORD_TYPE
&& (((tree_class_check (((tree_check ((pointee1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 533, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 533, __FUNCTION__))->type_common.lang_flag_2))))
&& TYPE_PTRMEM_P (pointee2)((((enum tree_code) (pointee2)->base.code) == OFFSET_TYPE)
|| (((enum tree_code) (pointee2)->base.code) == RECORD_TYPE
&& (((tree_class_check (((tree_check ((pointee2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 533, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 533, __FUNCTION__))->type_common.lang_flag_2))))
))
534 {
535 result_type = composite_pointer_type_r (location, pointee1, pointee2,
536 add_const, operation, complain);
537 if (result_type == error_mark_nodeglobal_trees[TI_ERROR_MARK])
538 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
539 }
540 else
541 {
542 if (complain & tf_error)
543 composite_pointer_error (location, DK_PERMERROR,
544 t1, t2, operation);
545 else
546 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
547 result_type = void_type_nodeglobal_trees[TI_VOID_TYPE];
548 }
549 const int q1 = cp_type_quals (pointee1);
550 const int q2 = cp_type_quals (pointee2);
551 const int quals = q1 | q2;
552 result_type = cp_build_qualified_type (result_type,cp_build_qualified_type_real ((result_type), ((quals | (*add_const
? TYPE_QUAL_CONST : TYPE_UNQUALIFIED))), tf_warning_or_error
)
553 (quals | (*add_constcp_build_qualified_type_real ((result_type), ((quals | (*add_const
? TYPE_QUAL_CONST : TYPE_UNQUALIFIED))), tf_warning_or_error
)
554 ? TYPE_QUAL_CONSTcp_build_qualified_type_real ((result_type), ((quals | (*add_const
? TYPE_QUAL_CONST : TYPE_UNQUALIFIED))), tf_warning_or_error
)
555 : TYPE_UNQUALIFIED)))cp_build_qualified_type_real ((result_type), ((quals | (*add_const
? TYPE_QUAL_CONST : TYPE_UNQUALIFIED))), tf_warning_or_error
)
;
556 /* The cv-combined type can add "const" as per [conv.qual]/3.3 (except for
557 the TLQ). The reason is that both T1 and T2 can then be converted to the
558 cv-combined type of T1 and T2. */
559 if (quals != q1 || quals != q2)
560 *add_const = true;
561 /* If the original types were pointers to members, so is the
562 result. */
563 if (TYPE_PTRMEM_P (t1)((((enum tree_code) (t1)->base.code) == OFFSET_TYPE) || ((
(enum tree_code) (t1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 563, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 563, __FUNCTION__))->type_common.lang_flag_2))))
)
564 {
565 if (!same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1),comptypes ((((((enum tree_code) (t1)->base.code) == OFFSET_TYPE
) ? ((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 565, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real
((((contains_struct_check ((((tree_check3 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 565, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 565, __FUNCTION__))->typed.type)), (cp_type_quals (t1)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 565, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 565, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))), (((((enum tree_code) (t2)->base.code) == OFFSET_TYPE
) ? ((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 566, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real
((((contains_struct_check ((((tree_check3 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 566, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 566, __FUNCTION__))->typed.type)), (cp_type_quals (t2)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 566, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 566, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))), 0)
566 TYPE_PTRMEM_CLASS_TYPE (t2))comptypes ((((((enum tree_code) (t1)->base.code) == OFFSET_TYPE
) ? ((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 565, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real
((((contains_struct_check ((((tree_check3 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 565, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 565, __FUNCTION__))->typed.type)), (cp_type_quals (t1)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 565, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 565, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))), (((((enum tree_code) (t2)->base.code) == OFFSET_TYPE
) ? ((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 566, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real
((((contains_struct_check ((((tree_check3 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 566, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 566, __FUNCTION__))->typed.type)), (cp_type_quals (t2)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 566, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 566, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))), 0)
)
567 {
568 if (complain & tf_error)
569 composite_pointer_error (location, DK_PERMERROR,
570 t1, t2, operation);
571 else
572 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
573 }
574 result_type = build_ptrmem_type (TYPE_PTRMEM_CLASS_TYPE (t1)((((enum tree_code) (t1)->base.code) == OFFSET_TYPE) ? ((tree_check
((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 574, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real
((((contains_struct_check ((((tree_check3 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 574, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 574, __FUNCTION__))->typed.type)), (cp_type_quals (t1)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 574, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 574, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))
,
575 result_type);
576 }
577 else
578 result_type = build_pointer_type (result_type);
579
580 /* Merge the attributes. */
581 attributes = (*targetm.merge_type_attributes) (t1, t2);
582 return build_type_attribute_variant (result_type, attributes);
583}
584
585/* Return the composite pointer type (see [expr.type]) for T1 and T2.
586 ARG1 and ARG2 are the values with those types. The OPERATION is to
587 describe the operation between the pointer types,
588 in case an error occurs.
589
590 This routine also implements the computation of a common type for
591 pointers-to-members as per [expr.eq]. */
592
593tree
594composite_pointer_type (const op_location_t &location,
595 tree t1, tree t2, tree arg1, tree arg2,
596 composite_pointer_operation operation,
597 tsubst_flags_t complain)
598{
599 tree class1;
600 tree class2;
601
602 /* [expr.type]
603
604 If one operand is a null pointer constant, the composite pointer
605 type is the type of the other operand. */
606 if (null_ptr_cst_p (arg1))
607 return t2;
608 if (null_ptr_cst_p (arg2))
609 return t1;
610
611 /* We have:
612
613 [expr.type]
614
615 If one of the operands has type "pointer to cv1 void", then
616 the other has type "pointer to cv2 T", and the composite pointer
617 type is "pointer to cv12 void", where cv12 is the union of cv1
618 and cv2.
619
620 If either type is a pointer to void, make sure it is T1. */
621 if (TYPE_PTR_P (t2)(((enum tree_code) (t2)->base.code) == POINTER_TYPE) && VOID_TYPE_P (TREE_TYPE (t2))(((enum tree_code) (((contains_struct_check ((t2), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 621, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
)
)
622 std::swap (t1, t2);
623
624 /* Now, if T1 is a pointer to void, merge the qualifiers. */
625 if (TYPE_PTR_P (t1)(((enum tree_code) (t1)->base.code) == POINTER_TYPE) && VOID_TYPE_P (TREE_TYPE (t1))(((enum tree_code) (((contains_struct_check ((t1), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 625, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
)
)
626 {
627 tree attributes;
628 tree result_type;
629
630 if (TYPE_PTRFN_P (t2)((((enum tree_code) (t2)->base.code) == POINTER_TYPE) &&
((enum tree_code) (((contains_struct_check ((t2), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 630, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
)
)
631 {
632 if (complain & tf_error)
633 {
634 switch (operation)
635 {
636 case CPO_COMPARISON:
637 pedwarn (location, OPT_Wpedantic,
638 "ISO C++ forbids comparison between pointer "
639 "of type %<void *%> and pointer-to-function");
640 break;
641 case CPO_CONVERSION:
642 pedwarn (location, OPT_Wpedantic,
643 "ISO C++ forbids conversion between pointer "
644 "of type %<void *%> and pointer-to-function");
645 break;
646 case CPO_CONDITIONAL_EXPR:
647 pedwarn (location, OPT_Wpedantic,
648 "ISO C++ forbids conditional expression between "
649 "pointer of type %<void *%> and "
650 "pointer-to-function");
651 break;
652 default:
653 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 653, __FUNCTION__))
;
654 }
655 }
656 else
657 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
658 }
659 result_type
660 = cp_build_qualified_type (void_type_node,cp_build_qualified_type_real ((global_trees[TI_VOID_TYPE]), (
(cp_type_quals (((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 661, __FUNCTION__))->typed.type)) | cp_type_quals (((contains_struct_check
((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 662, __FUNCTION__))->typed.type)))), tf_warning_or_error
)
661 (cp_type_quals (TREE_TYPE (t1))cp_build_qualified_type_real ((global_trees[TI_VOID_TYPE]), (
(cp_type_quals (((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 661, __FUNCTION__))->typed.type)) | cp_type_quals (((contains_struct_check
((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 662, __FUNCTION__))->typed.type)))), tf_warning_or_error
)
662 | cp_type_quals (TREE_TYPE (t2))))cp_build_qualified_type_real ((global_trees[TI_VOID_TYPE]), (
(cp_type_quals (((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 661, __FUNCTION__))->typed.type)) | cp_type_quals (((contains_struct_check
((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 662, __FUNCTION__))->typed.type)))), tf_warning_or_error
)
;
663 result_type = build_pointer_type (result_type);
664 /* Merge the attributes. */
665 attributes = (*targetm.merge_type_attributes) (t1, t2);
666 return build_type_attribute_variant (result_type, attributes);
667 }
668
669 if (c_dialect_objc ()((c_language & clk_objc) != 0) && TYPE_PTR_P (t1)(((enum tree_code) (t1)->base.code) == POINTER_TYPE)
670 && TYPE_PTR_P (t2)(((enum tree_code) (t2)->base.code) == POINTER_TYPE))
671 {
672 if (objc_have_common_type (t1, t2, -3, NULL_TREE(tree) __null))
673 return objc_common_type (t1, t2);
674 }
675
676 /* if T1 or T2 is "pointer to noexcept function" and the other type is
677 "pointer to function", where the function types are otherwise the same,
678 "pointer to function" */
679 if (fnptr_conv_p (t1, t2))
680 return t1;
681 if (fnptr_conv_p (t2, t1))
682 return t2;
683
684 /* [expr.eq] permits the application of a pointer conversion to
685 bring the pointers to a common type. */
686 if (TYPE_PTR_P (t1)(((enum tree_code) (t1)->base.code) == POINTER_TYPE) && TYPE_PTR_P (t2)(((enum tree_code) (t2)->base.code) == POINTER_TYPE)
687 && CLASS_TYPE_P (TREE_TYPE (t1))(((((enum tree_code) (((contains_struct_check ((t1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 687, __FUNCTION__))->typed.type))->base.code)) == RECORD_TYPE
|| (((enum tree_code) (((contains_struct_check ((t1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 687, __FUNCTION__))->typed.type))->base.code)) == UNION_TYPE
) && ((tree_class_check ((((contains_struct_check ((t1
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 687, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 687, __FUNCTION__))->type_common.lang_flag_5))
688 && CLASS_TYPE_P (TREE_TYPE (t2))(((((enum tree_code) (((contains_struct_check ((t2), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 688, __FUNCTION__))->typed.type))->base.code)) == RECORD_TYPE
|| (((enum tree_code) (((contains_struct_check ((t2), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 688, __FUNCTION__))->typed.type))->base.code)) == UNION_TYPE
) && ((tree_class_check ((((contains_struct_check ((t2
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 688, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 688, __FUNCTION__))->type_common.lang_flag_5))
689 && !same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 689, __FUNCTION__))->typed.type)
,
690 TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 690, __FUNCTION__))->typed.type)
))
691 {
692 class1 = TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 692, __FUNCTION__))->typed.type)
;
693 class2 = TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 693, __FUNCTION__))->typed.type)
;
694
695 if (DERIVED_FROM_P (class1, class2)(lookup_base ((class2), (class1), ba_any, __null, tf_none) !=
(tree) __null)
)
696 t2 = (build_pointer_type
697 (cp_build_qualified_type (class1, cp_type_quals (class2))cp_build_qualified_type_real ((class1), (cp_type_quals (class2
)), tf_warning_or_error)
));
698 else if (DERIVED_FROM_P (class2, class1)(lookup_base ((class1), (class2), ba_any, __null, tf_none) !=
(tree) __null)
)
699 t1 = (build_pointer_type
700 (cp_build_qualified_type (class2, cp_type_quals (class1))cp_build_qualified_type_real ((class2), (cp_type_quals (class1
)), tf_warning_or_error)
));
701 else
702 {
703 if (complain & tf_error)
704 composite_pointer_error (location, DK_ERROR, t1, t2, operation);
705 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
706 }
707 }
708 /* [expr.eq] permits the application of a pointer-to-member
709 conversion to change the class type of one of the types. */
710 else if (TYPE_PTRMEM_P (t1)((((enum tree_code) (t1)->base.code) == OFFSET_TYPE) || ((
(enum tree_code) (t1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 710, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 710, __FUNCTION__))->type_common.lang_flag_2))))
711 && !same_type_p (TYPE_PTRMEM_CLASS_TYPE (t1),comptypes ((((((enum tree_code) (t1)->base.code) == OFFSET_TYPE
) ? ((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 711, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real
((((contains_struct_check ((((tree_check3 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 711, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 711, __FUNCTION__))->typed.type)), (cp_type_quals (t1)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 711, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 711, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))), (((((enum tree_code) (t2)->base.code) == OFFSET_TYPE
) ? ((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 712, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real
((((contains_struct_check ((((tree_check3 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 712, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 712, __FUNCTION__))->typed.type)), (cp_type_quals (t2)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 712, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 712, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))), 0)
712 TYPE_PTRMEM_CLASS_TYPE (t2))comptypes ((((((enum tree_code) (t1)->base.code) == OFFSET_TYPE
) ? ((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 711, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real
((((contains_struct_check ((((tree_check3 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 711, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 711, __FUNCTION__))->typed.type)), (cp_type_quals (t1)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 711, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 711, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))), (((((enum tree_code) (t2)->base.code) == OFFSET_TYPE
) ? ((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 712, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real
((((contains_struct_check ((((tree_check3 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 712, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 712, __FUNCTION__))->typed.type)), (cp_type_quals (t2)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 712, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 712, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))), 0)
)
713 {
714 class1 = TYPE_PTRMEM_CLASS_TYPE (t1)((((enum tree_code) (t1)->base.code) == OFFSET_TYPE) ? ((tree_check
((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 714, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real
((((contains_struct_check ((((tree_check3 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 714, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 714, __FUNCTION__))->typed.type)), (cp_type_quals (t1)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 714, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 714, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))
;
715 class2 = TYPE_PTRMEM_CLASS_TYPE (t2)((((enum tree_code) (t2)->base.code) == OFFSET_TYPE) ? ((tree_check
((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 715, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real
((((contains_struct_check ((((tree_check3 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 715, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 715, __FUNCTION__))->typed.type)), (cp_type_quals (t2)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 715, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 715, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))
;
716
717 if (DERIVED_FROM_P (class1, class2)(lookup_base ((class2), (class1), ba_any, __null, tf_none) !=
(tree) __null)
)
718 t1 = build_ptrmem_type (class2, TYPE_PTRMEM_POINTED_TO_TYPE (t1)((((enum tree_code) (t1)->base.code) == OFFSET_TYPE) ? ((contains_struct_check
((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 718, __FUNCTION__))->typed.type) : ((contains_struct_check
(((cp_build_qualified_type_real ((((contains_struct_check ((
((tree_check3 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 718, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 718, __FUNCTION__))->typed.type)), (cp_type_quals (t1)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 718, __FUNCTION__))->typed.type))
);
719 else if (DERIVED_FROM_P (class2, class1)(lookup_base ((class1), (class2), ba_any, __null, tf_none) !=
(tree) __null)
)
720 t2 = build_ptrmem_type (class1, TYPE_PTRMEM_POINTED_TO_TYPE (t2)((((enum tree_code) (t2)->base.code) == OFFSET_TYPE) ? ((contains_struct_check
((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 720, __FUNCTION__))->typed.type) : ((contains_struct_check
(((cp_build_qualified_type_real ((((contains_struct_check ((
((tree_check3 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 720, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 720, __FUNCTION__))->typed.type)), (cp_type_quals (t2)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 720, __FUNCTION__))->typed.type))
);
721 else
722 {
723 if (complain & tf_error)
724 switch (operation)
725 {
726 case CPO_COMPARISON:
727 error_at (location, "comparison between distinct "
728 "pointer-to-member types %qT and %qT lacks a cast",
729 t1, t2);
730 break;
731 case CPO_CONVERSION:
732 error_at (location, "conversion between distinct "
733 "pointer-to-member types %qT and %qT lacks a cast",
734 t1, t2);
735 break;
736 case CPO_CONDITIONAL_EXPR:
737 error_at (location, "conditional expression between distinct "
738 "pointer-to-member types %qT and %qT lacks a cast",
739 t1, t2);
740 break;
741 default:
742 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 742, __FUNCTION__))
;
743 }
744 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
745 }
746 }
747
748 bool add_const = false;
749 return composite_pointer_type_r (location, t1, t2, &add_const, operation,
750 complain);
751}
752
753/* Return the merged type of two types.
754 We assume that comptypes has already been done and returned 1;
755 if that isn't so, this may crash.
756
757 This just combines attributes and default arguments; any other
758 differences would cause the two types to compare unalike. */
759
760tree
761merge_types (tree t1, tree t2)
762{
763 enum tree_code code1;
764 enum tree_code code2;
765 tree attributes;
766
767 /* Save time if the two types are the same. */
768 if (t1 == t2)
769 return t1;
770 if (original_type (t1) == original_type (t2))
771 return t1;
772
773 /* If one type is nonsense, use the other. */
774 if (t1 == error_mark_nodeglobal_trees[TI_ERROR_MARK])
775 return t2;
776 if (t2 == error_mark_nodeglobal_trees[TI_ERROR_MARK])
777 return t1;
778
779 /* Handle merging an auto redeclaration with a previous deduced
780 return type. */
781 if (is_auto (t1))
782 return t2;
783
784 /* Merge the attributes. */
785 attributes = (*targetm.merge_type_attributes) (t1, t2);
786
787 if (TYPE_PTRMEMFUNC_P (t1)(((enum tree_code) (t1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 787, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 787, __FUNCTION__))->type_common.lang_flag_2)))
)
788 t1 = TYPE_PTRMEMFUNC_FN_TYPE (t1)(cp_build_qualified_type_real ((((contains_struct_check ((((tree_check3
((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 788, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 788, __FUNCTION__))->typed.type)), (cp_type_quals (t1)),
tf_warning_or_error))
;
789 if (TYPE_PTRMEMFUNC_P (t2)(((enum tree_code) (t2)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 789, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 789, __FUNCTION__))->type_common.lang_flag_2)))
)
790 t2 = TYPE_PTRMEMFUNC_FN_TYPE (t2)(cp_build_qualified_type_real ((((contains_struct_check ((((tree_check3
((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 790, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 790, __FUNCTION__))->typed.type)), (cp_type_quals (t2)),
tf_warning_or_error))
;
791
792 code1 = TREE_CODE (t1)((enum tree_code) (t1)->base.code);
793 code2 = TREE_CODE (t2)((enum tree_code) (t2)->base.code);
794 if (code1 != code2)
795 {
796 gcc_assert (code1 == TYPENAME_TYPE || code2 == TYPENAME_TYPE)((void)(!(code1 == TYPENAME_TYPE || code2 == TYPENAME_TYPE) ?
fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 796, __FUNCTION__), 0 : 0))
;
797 if (code1 == TYPENAME_TYPE)
798 {
799 t1 = resolve_typename_type (t1, /*only_current_p=*/true);
800 code1 = TREE_CODE (t1)((enum tree_code) (t1)->base.code);
801 }
802 else
803 {
804 t2 = resolve_typename_type (t2, /*only_current_p=*/true);
805 code2 = TREE_CODE (t2)((enum tree_code) (t2)->base.code);
806 }
807 }
808
809 switch (code1)
810 {
811 case POINTER_TYPE:
812 case REFERENCE_TYPE:
813 /* For two pointers, do this recursively on the target type. */
814 {
815 tree target = merge_types (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 815, __FUNCTION__))->typed.type)
, TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 815, __FUNCTION__))->typed.type)
);
816 int quals = cp_type_quals (t1);
817
818 if (code1 == POINTER_TYPE)
819 {
820 t1 = build_pointer_type (target);
821 if (TREE_CODE (target)((enum tree_code) (target)->base.code) == METHOD_TYPE)
822 t1 = build_ptrmemfunc_type (t1);
823 }
824 else
825 t1 = cp_build_reference_type (target, TYPE_REF_IS_RVALUE (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 825, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
);
826 t1 = build_type_attribute_variant (t1, attributes);
827 t1 = cp_build_qualified_type (t1, quals)cp_build_qualified_type_real ((t1), (quals), tf_warning_or_error
)
;
828
829 return t1;
830 }
831
832 case OFFSET_TYPE:
833 {
834 int quals;
835 tree pointee;
836 quals = cp_type_quals (t1);
837 pointee = merge_types (TYPE_PTRMEM_POINTED_TO_TYPE (t1)((((enum tree_code) (t1)->base.code) == OFFSET_TYPE) ? ((contains_struct_check
((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 837, __FUNCTION__))->typed.type) : ((contains_struct_check
(((cp_build_qualified_type_real ((((contains_struct_check ((
((tree_check3 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 837, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 837, __FUNCTION__))->typed.type)), (cp_type_quals (t1)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 837, __FUNCTION__))->typed.type))
,
838 TYPE_PTRMEM_POINTED_TO_TYPE (t2)((((enum tree_code) (t2)->base.code) == OFFSET_TYPE) ? ((contains_struct_check
((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 838, __FUNCTION__))->typed.type) : ((contains_struct_check
(((cp_build_qualified_type_real ((((contains_struct_check ((
((tree_check3 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 838, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 838, __FUNCTION__))->typed.type)), (cp_type_quals (t2)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 838, __FUNCTION__))->typed.type))
);
839 t1 = build_ptrmem_type (TYPE_PTRMEM_CLASS_TYPE (t1)((((enum tree_code) (t1)->base.code) == OFFSET_TYPE) ? ((tree_check
((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 839, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real
((((contains_struct_check ((((tree_check3 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 839, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 839, __FUNCTION__))->typed.type)), (cp_type_quals (t1)),
tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 839, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 839, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))
,
840 pointee);
841 t1 = cp_build_qualified_type (t1, quals)cp_build_qualified_type_real ((t1), (quals), tf_warning_or_error
)
;
842 break;
843 }
844
845 case ARRAY_TYPE:
846 {
847 tree elt = merge_types (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 847, __FUNCTION__))->typed.type)
, TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 847, __FUNCTION__))->typed.type)
);
848 /* Save space: see if the result is identical to one of the args. */
849 if (elt == TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 849, __FUNCTION__))->typed.type)
&& TYPE_DOMAIN (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 849, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
)
850 return build_type_attribute_variant (t1, attributes);
851 if (elt == TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 851, __FUNCTION__))->typed.type)
&& TYPE_DOMAIN (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 851, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
)
852 return build_type_attribute_variant (t2, attributes);
853 /* Merge the element types, and have a size if either arg has one. */
854 t1 = build_cplus_array_type
855 (elt, TYPE_DOMAIN (TYPE_DOMAIN (t1) ? t1 : t2)((tree_check ((((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 855, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
) ? t1 : t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 855, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
);
856 break;
857 }
858
859 case FUNCTION_TYPE:
860 /* Function types: prefer the one that specified arg types.
861 If both do, merge the arg types. Also merge the return types. */
862 {
863 tree valtype = merge_types (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 863, __FUNCTION__))->typed.type)
, TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 863, __FUNCTION__))->typed.type)
);
864 tree p1 = TYPE_ARG_TYPES (t1)((tree_check2 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 864, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)
;
865 tree p2 = TYPE_ARG_TYPES (t2)((tree_check2 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 865, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)
;
866 tree parms;
867
868 /* Save space: see if the result is identical to one of the args. */
869 if (valtype == TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 869, __FUNCTION__))->typed.type)
&& ! p2)
870 return cp_build_type_attribute_variant (t1, attributes);
871 if (valtype == TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 871, __FUNCTION__))->typed.type)
&& ! p1)
872 return cp_build_type_attribute_variant (t2, attributes);
873
874 /* Simple way if one arg fails to specify argument types. */
875 if (p1 == NULL_TREE(tree) __null || TREE_VALUE (p1)((tree_check ((p1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 875, __FUNCTION__, (TREE_LIST)))->list.value)
== void_type_nodeglobal_trees[TI_VOID_TYPE])
876 parms = p2;
877 else if (p2 == NULL_TREE(tree) __null || TREE_VALUE (p2)((tree_check ((p2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 877, __FUNCTION__, (TREE_LIST)))->list.value)
== void_type_nodeglobal_trees[TI_VOID_TYPE])
878 parms = p1;
879 else
880 parms = commonparms (p1, p2);
881
882 cp_cv_quals quals = type_memfn_quals (t1);
883 cp_ref_qualifier rqual = type_memfn_rqual (t1);
884 gcc_assert (quals == type_memfn_quals (t2))((void)(!(quals == type_memfn_quals (t2)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 884, __FUNCTION__), 0 : 0))
;
885 gcc_assert (rqual == type_memfn_rqual (t2))((void)(!(rqual == type_memfn_rqual (t2)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 885, __FUNCTION__), 0 : 0))
;
886
887 tree rval = build_function_type (valtype, parms);
888 rval = apply_memfn_quals (rval, quals);
889 tree raises = merge_exception_specifiers (TYPE_RAISES_EXCEPTIONS (t1)((tree_class_check (((tree_check2 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 889, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 889, __FUNCTION__))->type_non_common.lang_1)
,
890 TYPE_RAISES_EXCEPTIONS (t2)((tree_class_check (((tree_check2 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 890, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 890, __FUNCTION__))->type_non_common.lang_1)
);
891 bool late_return_type_p = TYPE_HAS_LATE_RETURN_TYPE (t1)(((tree_class_check (((tree_check2 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 891, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 891, __FUNCTION__))->type_common.lang_flag_2))
;
892 t1 = build_cp_fntype_variant (rval, rqual, raises, late_return_type_p);
893 break;
894 }
895
896 case METHOD_TYPE:
897 {
898 /* Get this value the long way, since TYPE_METHOD_BASETYPE
899 is just the main variant of this. */
900 tree basetype = class_of_this_parm (t2);
901 tree raises = merge_exception_specifiers (TYPE_RAISES_EXCEPTIONS (t1)((tree_class_check (((tree_check2 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 901, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 901, __FUNCTION__))->type_non_common.lang_1)
,
902 TYPE_RAISES_EXCEPTIONS (t2)((tree_class_check (((tree_check2 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 902, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 902, __FUNCTION__))->type_non_common.lang_1)
);
903 cp_ref_qualifier rqual = type_memfn_rqual (t1);
904 tree t3;
905 bool late_return_type_1_p = TYPE_HAS_LATE_RETURN_TYPE (t1)(((tree_class_check (((tree_check2 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 905, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 905, __FUNCTION__))->type_common.lang_flag_2))
;
906
907 /* If this was a member function type, get back to the
908 original type of type member function (i.e., without
909 the class instance variable up front. */
910 t1 = build_function_type (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 910, __FUNCTION__))->typed.type)
,
911 TREE_CHAIN (TYPE_ARG_TYPES (t1))((contains_struct_check ((((tree_check2 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 911, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 911, __FUNCTION__))->common.chain)
);
912 t2 = build_function_type (TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 912, __FUNCTION__))->typed.type)
,
913 TREE_CHAIN (TYPE_ARG_TYPES (t2))((contains_struct_check ((((tree_check2 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 913, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 913, __FUNCTION__))->common.chain)
);
914 t3 = merge_types (t1, t2);
915 t3 = build_method_type_directly (basetype, TREE_TYPE (t3)((contains_struct_check ((t3), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 915, __FUNCTION__))->typed.type)
,
916 TYPE_ARG_TYPES (t3)((tree_check2 ((t3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 916, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)
);
917 t1 = build_cp_fntype_variant (t3, rqual, raises, late_return_type_1_p);
918 break;
919 }
920
921 case TYPENAME_TYPE:
922 /* There is no need to merge attributes into a TYPENAME_TYPE.
923 When the type is instantiated it will have whatever
924 attributes result from the instantiation. */
925 return t1;
926
927 default:;
928 if (attribute_list_equal (TYPE_ATTRIBUTES (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 928, __FUNCTION__))->type_common.attributes)
, attributes))
929 return t1;
930 else if (attribute_list_equal (TYPE_ATTRIBUTES (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 930, __FUNCTION__))->type_common.attributes)
, attributes))
931 return t2;
932 break;
933 }
934
935 return cp_build_type_attribute_variant (t1, attributes);
936}
937
938/* Return the ARRAY_TYPE type without its domain. */
939
940tree
941strip_array_domain (tree type)
942{
943 tree t2;
944 gcc_assert (TREE_CODE (type) == ARRAY_TYPE)((void)(!(((enum tree_code) (type)->base.code) == ARRAY_TYPE
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 944, __FUNCTION__), 0 : 0))
;
945 if (TYPE_DOMAIN (type)((tree_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 945, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
== NULL_TREE(tree) __null)
946 return type;
947 t2 = build_cplus_array_type (TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 947, __FUNCTION__))->typed.type)
, NULL_TREE(tree) __null);
948 return cp_build_type_attribute_variant (t2, TYPE_ATTRIBUTES (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 948, __FUNCTION__))->type_common.attributes)
);
949}
950
951/* Wrapper around cp_common_type that is used by c-common.c and other
952 front end optimizations that remove promotions.
953
954 Return the common type for two arithmetic types T1 and T2 under the
955 usual arithmetic conversions. The default conversions have already
956 been applied, and enumerated types converted to their compatible
957 integer types. */
958
959tree
960common_type (tree t1, tree t2)
961{
962 /* If one type is nonsense, use the other */
963 if (t1 == error_mark_nodeglobal_trees[TI_ERROR_MARK])
964 return t2;
965 if (t2 == error_mark_nodeglobal_trees[TI_ERROR_MARK])
966 return t1;
967
968 return cp_common_type (t1, t2);
969}
970
971/* Return the common type of two pointer types T1 and T2. This is the
972 type for the result of most arithmetic operations if the operands
973 have the given two types.
974
975 We assume that comp_target_types has already been done and returned
976 nonzero; if that isn't so, this may crash. */
977
978tree
979common_pointer_type (tree t1, tree t2)
980{
981 gcc_assert ((TYPE_PTR_P (t1) && TYPE_PTR_P (t2))((void)(!(((((enum tree_code) (t1)->base.code) == POINTER_TYPE
) && (((enum tree_code) (t2)->base.code) == POINTER_TYPE
)) || ((((enum tree_code) (t1)->base.code) == OFFSET_TYPE)
&& (((enum tree_code) (t2)->base.code) == OFFSET_TYPE
)) || ((((enum tree_code) (t1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 983, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 983, __FUNCTION__))->type_common.lang_flag_2))) &&
(((enum tree_code) (t2)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 983, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 983, __FUNCTION__))->type_common.lang_flag_2))))) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 983, __FUNCTION__), 0 : 0))
982 || (TYPE_PTRDATAMEM_P (t1) && TYPE_PTRDATAMEM_P (t2))((void)(!(((((enum tree_code) (t1)->base.code) == POINTER_TYPE
) && (((enum tree_code) (t2)->base.code) == POINTER_TYPE
)) || ((((enum tree_code) (t1)->base.code) == OFFSET_TYPE)
&& (((enum tree_code) (t2)->base.code) == OFFSET_TYPE
)) || ((((enum tree_code) (t1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 983, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 983, __FUNCTION__))->type_common.lang_flag_2))) &&
(((enum tree_code) (t2)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 983, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 983, __FUNCTION__))->type_common.lang_flag_2))))) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 983, __FUNCTION__), 0 : 0))
983 || (TYPE_PTRMEMFUNC_P (t1) && TYPE_PTRMEMFUNC_P (t2)))((void)(!(((((enum tree_code) (t1)->base.code) == POINTER_TYPE
) && (((enum tree_code) (t2)->base.code) == POINTER_TYPE
)) || ((((enum tree_code) (t1)->base.code) == OFFSET_TYPE)
&& (((enum tree_code) (t2)->base.code) == OFFSET_TYPE
)) || ((((enum tree_code) (t1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 983, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 983, __FUNCTION__))->type_common.lang_flag_2))) &&
(((enum tree_code) (t2)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 983, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 983, __FUNCTION__))->type_common.lang_flag_2))))) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 983, __FUNCTION__), 0 : 0))
;
984
985 return composite_pointer_type (input_location, t1, t2,
986 error_mark_nodeglobal_trees[TI_ERROR_MARK], error_mark_nodeglobal_trees[TI_ERROR_MARK],
987 CPO_CONVERSION, tf_warning_or_error);
988}
989
990/* Compare two exception specifier types for exactness or subsetness, if
991 allowed. Returns false for mismatch, true for match (same, or
992 derived and !exact).
993
994 [except.spec] "If a class X ... objects of class X or any class publicly
995 and unambiguously derived from X. Similarly, if a pointer type Y * ...
996 exceptions of type Y * or that are pointers to any type publicly and
997 unambiguously derived from Y. Otherwise a function only allows exceptions
998 that have the same type ..."
999 This does not mention cv qualifiers and is different to what throw
1000 [except.throw] and catch [except.catch] will do. They will ignore the
1001 top level cv qualifiers, and allow qualifiers in the pointer to class
1002 example.
1003
1004 We implement the letter of the standard. */
1005
1006static bool
1007comp_except_types (tree a, tree b, bool exact)
1008{
1009 if (same_type_p (a, b)comptypes ((a), (b), 0))
1010 return true;
1011 else if (!exact)
1012 {
1013 if (cp_type_quals (a) || cp_type_quals (b))
1014 return false;
1015
1016 if (TYPE_PTR_P (a)(((enum tree_code) (a)->base.code) == POINTER_TYPE) && TYPE_PTR_P (b)(((enum tree_code) (b)->base.code) == POINTER_TYPE))
1017 {
1018 a = TREE_TYPE (a)((contains_struct_check ((a), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1018, __FUNCTION__))->typed.type)
;
1019 b = TREE_TYPE (b)((contains_struct_check ((b), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1019, __FUNCTION__))->typed.type)
;
1020 if (cp_type_quals (a) || cp_type_quals (b))
1021 return false;
1022 }
1023
1024 if (TREE_CODE (a)((enum tree_code) (a)->base.code) != RECORD_TYPE
1025 || TREE_CODE (b)((enum tree_code) (b)->base.code) != RECORD_TYPE)
1026 return false;
1027
1028 if (publicly_uniquely_derived_p (a, b))
1029 return true;
1030 }
1031 return false;
1032}
1033
1034/* Return true if TYPE1 and TYPE2 are equivalent exception specifiers.
1035 If EXACT is ce_derived, T2 can be stricter than T1 (according to 15.4/5).
1036 If EXACT is ce_type, the C++17 type compatibility rules apply.
1037 If EXACT is ce_normal, the compatibility rules in 15.4/3 apply.
1038 If EXACT is ce_exact, the specs must be exactly the same. Exception lists
1039 are unordered, but we've already filtered out duplicates. Most lists will
1040 be in order, we should try to make use of that. */
1041
1042bool
1043comp_except_specs (const_tree t1, const_tree t2, int exact)
1044{
1045 const_tree probe;
1046 const_tree base;
1047 int length = 0;
1048
1049 if (t1 == t2)
1050 return true;
1051
1052 /* First handle noexcept. */
1053 if (exact < ce_exact)
1054 {
1055 if (exact == ce_type
1056 && (canonical_eh_spec (CONST_CAST_TREE (t1)(const_cast<union tree_node *> (((t1)))))
1057 == canonical_eh_spec (CONST_CAST_TREE (t2)(const_cast<union tree_node *> (((t2)))))))
1058 return true;
1059
1060 /* noexcept(false) is compatible with no exception-specification,
1061 and less strict than any spec. */
1062 if (t1 == noexcept_false_speccp_global_trees[CPTI_NOEXCEPT_FALSE_SPEC])
1063 return t2 == NULL_TREE(tree) __null || exact == ce_derived;
1064 /* Even a derived noexcept(false) is compatible with no
1065 exception-specification. */
1066 if (t2 == noexcept_false_speccp_global_trees[CPTI_NOEXCEPT_FALSE_SPEC])
1067 return t1 == NULL_TREE(tree) __null;
1068
1069 /* Otherwise, if we aren't looking for an exact match, noexcept is
1070 equivalent to throw(). */
1071 if (t1 == noexcept_true_speccp_global_trees[CPTI_NOEXCEPT_TRUE_SPEC])
1072 t1 = empty_except_speccp_global_trees[CPTI_EMPTY_EXCEPT_SPEC];
1073 if (t2 == noexcept_true_speccp_global_trees[CPTI_NOEXCEPT_TRUE_SPEC])
1074 t2 = empty_except_speccp_global_trees[CPTI_EMPTY_EXCEPT_SPEC];
1075 }
1076
1077 /* If any noexcept is left, it is only comparable to itself;
1078 either we're looking for an exact match or we're redeclaring a
1079 template with dependent noexcept. */
1080 if ((t1 && TREE_PURPOSE (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1080, __FUNCTION__, (TREE_LIST)))->list.purpose)
)
1081 || (t2 && TREE_PURPOSE (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1081, __FUNCTION__, (TREE_LIST)))->list.purpose)
))
1082 return (t1 && t2
1083 && cp_tree_equal (TREE_PURPOSE (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1083, __FUNCTION__, (TREE_LIST)))->list.purpose)
, TREE_PURPOSE (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1083, __FUNCTION__, (TREE_LIST)))->list.purpose)
));
1084
1085 if (t1 == NULL_TREE(tree) __null) /* T1 is ... */
1086 return t2 == NULL_TREE(tree) __null || exact == ce_derived;
1087 if (!TREE_VALUE (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1087, __FUNCTION__, (TREE_LIST)))->list.value)
) /* t1 is EMPTY */
1088 return t2 != NULL_TREE(tree) __null && !TREE_VALUE (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1088, __FUNCTION__, (TREE_LIST)))->list.value)
;
1089 if (t2 == NULL_TREE(tree) __null) /* T2 is ... */
1090 return false;
1091 if (TREE_VALUE (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1091, __FUNCTION__, (TREE_LIST)))->list.value)
&& !TREE_VALUE (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1091, __FUNCTION__, (TREE_LIST)))->list.value)
) /* T2 is EMPTY, T1 is not */
1092 return exact == ce_derived;
1093
1094 /* Neither set is ... or EMPTY, make sure each part of T2 is in T1.
1095 Count how many we find, to determine exactness. For exact matching and
1096 ordered T1, T2, this is an O(n) operation, otherwise its worst case is
1097 O(nm). */
1098 for (base = t1; t2 != NULL_TREE(tree) __null; t2 = TREE_CHAIN (t2)((contains_struct_check ((t2), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1098, __FUNCTION__))->common.chain)
)
1099 {
1100 for (probe = base; probe != NULL_TREE(tree) __null; probe = TREE_CHAIN (probe)((contains_struct_check ((probe), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1100, __FUNCTION__))->common.chain)
)
1101 {
1102 tree a = TREE_VALUE (probe)((tree_check ((probe), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1102, __FUNCTION__, (TREE_LIST)))->list.value)
;
1103 tree b = TREE_VALUE (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1103, __FUNCTION__, (TREE_LIST)))->list.value)
;
1104
1105 if (comp_except_types (a, b, exact))
1106 {
1107 if (probe == base && exact > ce_derived)
1108 base = TREE_CHAIN (probe)((contains_struct_check ((probe), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1108, __FUNCTION__))->common.chain)
;
1109 length++;
1110 break;
1111 }
1112 }
1113 if (probe == NULL_TREE(tree) __null)
1114 return false;
1115 }
1116 return exact == ce_derived || base == NULL_TREE(tree) __null || length == list_length (t1);
1117}
1118
1119/* Compare the array types T1 and T2. CB says how we should behave when
1120 comparing array bounds: bounds_none doesn't allow dimensionless arrays,
1121 bounds_either says than any array can be [], bounds_first means that
1122 onlt T1 can be an array with unknown bounds. STRICT is true if
1123 qualifiers must match when comparing the types of the array elements. */
1124
1125static bool
1126comp_array_types (const_tree t1, const_tree t2, compare_bounds_t cb,
1127 bool strict)
1128{
1129 tree d1;
1130 tree d2;
1131 tree max1, max2;
1132
1133 if (t1 == t2)
1134 return true;
1135
1136 /* The type of the array elements must be the same. */
1137 if (strict
1138 ? !same_type_p (TREE_TYPE (t1), TREE_TYPE (t2))comptypes ((((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1138, __FUNCTION__))->typed.type)), (((contains_struct_check
((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1138, __FUNCTION__))->typed.type)), 0)
1139 : !similar_type_p (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1139, __FUNCTION__))->typed.type)
, TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1139, __FUNCTION__))->typed.type)
))
1140 return false;
1141
1142 d1 = TYPE_DOMAIN (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1142, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
;
1143 d2 = TYPE_DOMAIN (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1143, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
;
1144
1145 if (d1 == d2)
1146 return true;
1147
1148 /* If one of the arrays is dimensionless, and the other has a
1149 dimension, they are of different types. However, it is valid to
1150 write:
1151
1152 extern int a[];
1153 int a[3];
1154
1155 by [basic.link]:
1156
1157 declarations for an array object can specify
1158 array types that differ by the presence or absence of a major
1159 array bound (_dcl.array_). */
1160 if (!d1 && d2)
1161 return cb >= bounds_either;
1162 else if (d1 && !d2)
1163 return cb == bounds_either;
1164
1165 /* Check that the dimensions are the same. */
1166
1167 if (!cp_tree_equal (TYPE_MIN_VALUE (d1)((tree_check5 ((d1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1167, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE
), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval
)
, TYPE_MIN_VALUE (d2)((tree_check5 ((d2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1167, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE
), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.minval
)
))
1168 return false;
1169 max1 = TYPE_MAX_VALUE (d1)((tree_check5 ((d1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1169, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE
), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval
)
;
1170 max2 = TYPE_MAX_VALUE (d2)((tree_check5 ((d2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1170, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE
), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval
)
;
1171
1172 if (!cp_tree_equal (max1, max2))
1173 return false;
1174
1175 return true;
1176}
1177
1178/* Compare the relative position of T1 and T2 into their respective
1179 template parameter list.
1180 T1 and T2 must be template parameter types.
1181 Return TRUE if T1 and T2 have the same position, FALSE otherwise. */
1182
1183static bool
1184comp_template_parms_position (tree t1, tree t2)
1185{
1186 tree index1, index2;
1187 gcc_assert (t1 && t2((void)(!(t1 && t2 && ((enum tree_code) (t1)->
base.code) == ((enum tree_code) (t2)->base.code) &&
(((enum tree_code) (t1)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (t1)->base.code) == TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (t1)->base.code) == TEMPLATE_TYPE_PARM
)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1191, __FUNCTION__), 0 : 0))
1188 && TREE_CODE (t1) == TREE_CODE (t2)((void)(!(t1 && t2 && ((enum tree_code) (t1)->
base.code) == ((enum tree_code) (t2)->base.code) &&
(((enum tree_code) (t1)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (t1)->base.code) == TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (t1)->base.code) == TEMPLATE_TYPE_PARM
)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1191, __FUNCTION__), 0 : 0))
1189 && (TREE_CODE (t1) == BOUND_TEMPLATE_TEMPLATE_PARM((void)(!(t1 && t2 && ((enum tree_code) (t1)->
base.code) == ((enum tree_code) (t2)->base.code) &&
(((enum tree_code) (t1)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (t1)->base.code) == TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (t1)->base.code) == TEMPLATE_TYPE_PARM
)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1191, __FUNCTION__), 0 : 0))
1190 || TREE_CODE (t1) == TEMPLATE_TEMPLATE_PARM((void)(!(t1 && t2 && ((enum tree_code) (t1)->
base.code) == ((enum tree_code) (t2)->base.code) &&
(((enum tree_code) (t1)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (t1)->base.code) == TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (t1)->base.code) == TEMPLATE_TYPE_PARM
)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1191, __FUNCTION__), 0 : 0))
1191 || TREE_CODE (t1) == TEMPLATE_TYPE_PARM))((void)(!(t1 && t2 && ((enum tree_code) (t1)->
base.code) == ((enum tree_code) (t2)->base.code) &&
(((enum tree_code) (t1)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (t1)->base.code) == TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (t1)->base.code) == TEMPLATE_TYPE_PARM
)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1191, __FUNCTION__), 0 : 0))
;
1192
1193 index1 = TEMPLATE_TYPE_PARM_INDEX (TYPE_MAIN_VARIANT (t1))(((tree_class_check (((tree_check3 (((((tree_class_check ((t1
), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1193, __FUNCTION__))->type_common.main_variant))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1193, __FUNCTION__, (TEMPLATE_TYPE_PARM), (TEMPLATE_TEMPLATE_PARM
), (BOUND_TEMPLATE_TEMPLATE_PARM)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1193, __FUNCTION__))->type_non_common.values))
;
1194 index2 = TEMPLATE_TYPE_PARM_INDEX (TYPE_MAIN_VARIANT (t2))(((tree_class_check (((tree_check3 (((((tree_class_check ((t2
), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1194, __FUNCTION__))->type_common.main_variant))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1194, __FUNCTION__, (TEMPLATE_TYPE_PARM), (TEMPLATE_TEMPLATE_PARM
), (BOUND_TEMPLATE_TEMPLATE_PARM)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1194, __FUNCTION__))->type_non_common.values))
;
1195
1196 /* Then compare their relative position. */
1197 if (TEMPLATE_PARM_IDX (index1)(((template_parm_index*)(tree_check ((index1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1197, __FUNCTION__, (TEMPLATE_PARM_INDEX))))->index)
!= TEMPLATE_PARM_IDX (index2)(((template_parm_index*)(tree_check ((index2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1197, __FUNCTION__, (TEMPLATE_PARM_INDEX))))->index)
1198 || TEMPLATE_PARM_LEVEL (index1)(((template_parm_index*)(tree_check ((index1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1198, __FUNCTION__, (TEMPLATE_PARM_INDEX))))->level)
!= TEMPLATE_PARM_LEVEL (index2)(((template_parm_index*)(tree_check ((index2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1198, __FUNCTION__, (TEMPLATE_PARM_INDEX))))->level)
1199 || (TEMPLATE_PARM_PARAMETER_PACK (index1)(((tree_not_check2 (((tree_check ((index1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1199, __FUNCTION__, (TEMPLATE_PARM_INDEX)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1199, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0))
1200 != TEMPLATE_PARM_PARAMETER_PACK (index2)(((tree_not_check2 (((tree_check ((index2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1200, __FUNCTION__, (TEMPLATE_PARM_INDEX)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1200, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0))
))
1201 return false;
1202
1203 /* In C++14 we can end up comparing 'auto' to a normal template
1204 parameter. Don't confuse them. */
1205 if (cxx_dialect >= cxx14 && (is_auto (t1) || is_auto (t2)))
1206 return TYPE_IDENTIFIER (t1)(((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1206, __FUNCTION__))->type_common.name) && (tree_code_type
[(int) (((enum tree_code) (((tree_class_check ((t1), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1206, __FUNCTION__))->type_common.name))->base.code))
] == tcc_declaration) ? ((contains_struct_check ((((tree_class_check
((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1206, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1206, __FUNCTION__))->decl_minimal.name) : ((tree_class_check
((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1206, __FUNCTION__))->type_common.name))
== TYPE_IDENTIFIER (t2)(((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1206, __FUNCTION__))->type_common.name) && (tree_code_type
[(int) (((enum tree_code) (((tree_class_check ((t2), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1206, __FUNCTION__))->type_common.name))->base.code))
] == tcc_declaration) ? ((contains_struct_check ((((tree_class_check
((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1206, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1206, __FUNCTION__))->decl_minimal.name) : ((tree_class_check
((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1206, __FUNCTION__))->type_common.name))
;
1207
1208 return true;
1209}
1210
1211/* Heuristic check if two parameter types can be considered ABI-equivalent. */
1212
1213static bool
1214cxx_safe_arg_type_equiv_p (tree t1, tree t2)
1215{
1216 t1 = TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1216, __FUNCTION__))->type_common.main_variant)
;
1217 t2 = TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1217, __FUNCTION__))->type_common.main_variant)
;
1218
1219 if (TYPE_PTR_P (t1)(((enum tree_code) (t1)->base.code) == POINTER_TYPE)
1220 && TYPE_PTR_P (t2)(((enum tree_code) (t2)->base.code) == POINTER_TYPE))
1221 return true;
1222
1223 /* The signedness of the parameter matters only when an integral
1224 type smaller than int is promoted to int, otherwise only the
1225 precision of the parameter matters.
1226 This check should make sure that the callee does not see
1227 undefined values in argument registers. */
1228 if (INTEGRAL_TYPE_P (t1)(((enum tree_code) (t1)->base.code) == ENUMERAL_TYPE || ((
enum tree_code) (t1)->base.code) == BOOLEAN_TYPE || ((enum
tree_code) (t1)->base.code) == INTEGER_TYPE)
1229 && INTEGRAL_TYPE_P (t2)(((enum tree_code) (t2)->base.code) == ENUMERAL_TYPE || ((
enum tree_code) (t2)->base.code) == BOOLEAN_TYPE || ((enum
tree_code) (t2)->base.code) == INTEGER_TYPE)
1230 && TYPE_PRECISION (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1230, __FUNCTION__))->type_common.precision)
== TYPE_PRECISION (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1230, __FUNCTION__))->type_common.precision)
1231 && (TYPE_UNSIGNED (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1231, __FUNCTION__))->base.u.bits.unsigned_flag)
== TYPE_UNSIGNED (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1231, __FUNCTION__))->base.u.bits.unsigned_flag)
1232 || !targetm.calls.promote_prototypes (NULL_TREE(tree) __null)
1233 || TYPE_PRECISION (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1233, __FUNCTION__))->type_common.precision)
>= TYPE_PRECISION (integer_type_node)((tree_class_check ((integer_types[itk_int]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1233, __FUNCTION__))->type_common.precision)
))
1234 return true;
1235
1236 return same_type_p (t1, t2)comptypes ((t1), (t2), 0);
1237}
1238
1239/* Check if a type cast between two function types can be considered safe. */
1240
1241static bool
1242cxx_safe_function_type_cast_p (tree t1, tree t2)
1243{
1244 if (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1244, __FUNCTION__))->typed.type)
== void_type_nodeglobal_trees[TI_VOID_TYPE] &&
1245 TYPE_ARG_TYPES (t1)((tree_check2 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1245, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)
== void_list_nodeglobal_trees[TI_VOID_LIST_NODE])
1246 return true;
1247
1248 if (TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1248, __FUNCTION__))->typed.type)
== void_type_nodeglobal_trees[TI_VOID_TYPE] &&
1249 TYPE_ARG_TYPES (t2)((tree_check2 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1249, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)
== void_list_nodeglobal_trees[TI_VOID_LIST_NODE])
1250 return true;
1251
1252 if (!cxx_safe_arg_type_equiv_p (TREE_TYPE (t1)((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1252, __FUNCTION__))->typed.type)
, TREE_TYPE (t2)((contains_struct_check ((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1252, __FUNCTION__))->typed.type)
))
1253 return false;
1254
1255 for (t1 = TYPE_ARG_TYPES (t1)((tree_check2 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1255, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)
, t2 = TYPE_ARG_TYPES (t2)((tree_check2 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1255, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)
;
1256 t1 && t2;
1257 t1 = TREE_CHAIN (t1)((contains_struct_check ((t1), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1257, __FUNCTION__))->common.chain)
, t2 = TREE_CHAIN (t2)((contains_struct_check ((t2), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1257, __FUNCTION__))->common.chain)
)
1258 if (!cxx_safe_arg_type_equiv_p (TREE_VALUE (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1258, __FUNCTION__, (TREE_LIST)))->list.value)
, TREE_VALUE (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1258, __FUNCTION__, (TREE_LIST)))->list.value)
))
1259 return false;
1260
1261 return true;
1262}
1263
1264/* Subroutine in comptypes. */
1265
1266static bool
1267structural_comptypes (tree t1, tree t2, int strict)
1268{
1269 /* Both should be types that are not obviously the same. */
1270 gcc_checking_assert (t1 != t2 && TYPE_P (t1) && TYPE_P (t2))((void)(!(t1 != t2 && (tree_code_type[(int) (((enum tree_code
) (t1)->base.code))] == tcc_type) && (tree_code_type
[(int) (((enum tree_code) (t2)->base.code))] == tcc_type))
? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1270, __FUNCTION__), 0 : 0))
;
1271
1272 /* Suppress typename resolution under spec_hasher::equal in place of calling
1273 push_to_top_level there. */
1274 if (!comparing_specializations)
1275 {
1276 /* TYPENAME_TYPEs should be resolved if the qualifying scope is the
1277 current instantiation. */
1278 if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) == TYPENAME_TYPE)
1279 t1 = resolve_typename_type (t1, /*only_current_p=*/true);
1280
1281 if (TREE_CODE (t2)((enum tree_code) (t2)->base.code) == TYPENAME_TYPE)
1282 t2 = resolve_typename_type (t2, /*only_current_p=*/true);
1283 }
1284
1285 if (TYPE_PTRMEMFUNC_P (t1)(((enum tree_code) (t1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1285, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1285, __FUNCTION__))->type_common.lang_flag_2)))
)
1286 t1 = TYPE_PTRMEMFUNC_FN_TYPE (t1)(cp_build_qualified_type_real ((((contains_struct_check ((((tree_check3
((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1286, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1286, __FUNCTION__))->typed.type)), (cp_type_quals (t1))
, tf_warning_or_error))
;
1287 if (TYPE_PTRMEMFUNC_P (t2)(((enum tree_code) (t2)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1287, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1287, __FUNCTION__))->type_common.lang_flag_2)))
)
1288 t2 = TYPE_PTRMEMFUNC_FN_TYPE (t2)(cp_build_qualified_type_real ((((contains_struct_check ((((tree_check3
((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1288, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1288, __FUNCTION__))->typed.type)), (cp_type_quals (t2))
, tf_warning_or_error))
;
1289
1290 /* Different classes of types can't be compatible. */
1291 if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) != TREE_CODE (t2)((enum tree_code) (t2)->base.code))
1292 return false;
1293
1294 /* Qualifiers must match. For array types, we will check when we
1295 recur on the array element types. */
1296 if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) != ARRAY_TYPE
1297 && cp_type_quals (t1) != cp_type_quals (t2))
1298 return false;
1299 if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) == FUNCTION_TYPE
1300 && type_memfn_quals (t1) != type_memfn_quals (t2))
1301 return false;
1302 /* Need to check this before TYPE_MAIN_VARIANT.
1303 FIXME function qualifiers should really change the main variant. */
1304 if (FUNC_OR_METHOD_TYPE_P (t1)(((enum tree_code) (t1)->base.code) == FUNCTION_TYPE || ((
enum tree_code) (t1)->base.code) == METHOD_TYPE)
)
1305 {
1306 if (type_memfn_rqual (t1) != type_memfn_rqual (t2))
1307 return false;
1308 if (flag_noexcept_type
1309 && !comp_except_specs (TYPE_RAISES_EXCEPTIONS (t1)((tree_class_check (((tree_check2 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1309, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1309, __FUNCTION__))->type_non_common.lang_1)
,
1310 TYPE_RAISES_EXCEPTIONS (t2)((tree_class_check (((tree_check2 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1310, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1310, __FUNCTION__))->type_non_common.lang_1)
,
1311 ce_type))
1312 return false;
1313 }
1314
1315 /* Allow for two different type nodes which have essentially the same
1316 definition. Note that we already checked for equality of the type
1317 qualifiers (just above). */
1318 if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) != ARRAY_TYPE
1319 && TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1319, __FUNCTION__))->type_common.main_variant)
== TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1319, __FUNCTION__))->type_common.main_variant)
)
1320 goto check_alias;
1321
1322 /* Compare the types. Return false on known not-same. Break on not
1323 known. Never return true from this switch -- you'll break
1324 specialization comparison. */
1325 switch (TREE_CODE (t1)((enum tree_code) (t1)->base.code))
1326 {
1327 case VOID_TYPE:
1328 case BOOLEAN_TYPE:
1329 /* All void and bool types are the same. */
1330 break;
1331
1332 case OPAQUE_TYPE:
1333 case INTEGER_TYPE:
1334 case FIXED_POINT_TYPE:
1335 case REAL_TYPE:
1336 /* With these nodes, we can't determine type equivalence by
1337 looking at what is stored in the nodes themselves, because
1338 two nodes might have different TYPE_MAIN_VARIANTs but still
1339 represent the same type. For example, wchar_t and int could
1340 have the same properties (TYPE_PRECISION, TYPE_MIN_VALUE,
1341 TYPE_MAX_VALUE, etc.), but have different TYPE_MAIN_VARIANTs
1342 and are distinct types. On the other hand, int and the
1343 following typedef
1344
1345 typedef int INT __attribute((may_alias));
1346
1347 have identical properties, different TYPE_MAIN_VARIANTs, but
1348 represent the same type. The canonical type system keeps
1349 track of equivalence in this case, so we fall back on it. */
1350 if (TYPE_CANONICAL (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1350, __FUNCTION__))->type_common.canonical)
!= TYPE_CANONICAL (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1350, __FUNCTION__))->type_common.canonical)
)
1351 return false;
1352
1353 /* We don't need or want the attribute comparison. */
1354 goto check_alias;
1355
1356 case TEMPLATE_TEMPLATE_PARM:
1357 case BOUND_TEMPLATE_TEMPLATE_PARM:
1358 if (!comp_template_parms_position (t1, t2))
1359 return false;
1360 if (!comp_template_parms
1361 (DECL_TEMPLATE_PARMS (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t1))((struct tree_template_decl *)(const_cast<union tree_node *
> ((((tree_check ((((((enum tree_code) (t1)->base.code)
== BOUND_TEMPLATE_TEMPLATE_PARM) ? (((struct tree_template_info
*)(tree_check (((((enum tree_code) (t1)->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (t1)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| (((enum tree_code) (t1)->base.code) == RECORD_TYPE || (
(enum tree_code) (t1)->base.code) == UNION_TYPE || ((enum tree_code
) (t1)->base.code) == QUAL_UNION_TYPE) ? ((tree_class_check
((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1361, __FUNCTION__))->type_non_common.lang_1) : (tree) __null
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1361, __FUNCTION__, (TEMPLATE_INFO))))->tmpl) : ((tree_class_check
((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1361, __FUNCTION__))->type_common.name))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1361, __FUNCTION__, (TEMPLATE_DECL))))))))->arguments
,
1362 DECL_TEMPLATE_PARMS (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t2))((struct tree_template_decl *)(const_cast<union tree_node *
> ((((tree_check ((((((enum tree_code) (t2)->base.code)
== BOUND_TEMPLATE_TEMPLATE_PARM) ? (((struct tree_template_info
*)(tree_check (((((enum tree_code) (t2)->base.code) == ENUMERAL_TYPE
|| ((enum tree_code) (t2)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| (((enum tree_code) (t2)->base.code) == RECORD_TYPE || (
(enum tree_code) (t2)->base.code) == UNION_TYPE || ((enum tree_code
) (t2)->base.code) == QUAL_UNION_TYPE) ? ((tree_class_check
((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1362, __FUNCTION__))->type_non_common.lang_1) : (tree) __null
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1362, __FUNCTION__, (TEMPLATE_INFO))))->tmpl) : ((tree_class_check
((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1362, __FUNCTION__))->type_common.name))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1362, __FUNCTION__, (TEMPLATE_DECL))))))))->arguments
))
1363 return false;
1364 if (TREE_CODE (t1)((enum tree_code) (t1)->base.code) == TEMPLATE_TEMPLATE_PARM)
1365 break;
1366 /* Don't check inheritance. */
1367 strict = COMPARE_STRICT0;
1368 /* Fall through. */
1369
1370 case RECORD_TYPE:
1371 case UNION_TYPE:
1372 if (TYPE_TEMPLATE_INFO (t1)(((enum tree_code) (t1)->base.code) == ENUMERAL_TYPE || ((
enum tree_code) (t1)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| (((enum tree_code) (t1)->base.code) == RECORD_TYPE || (
(enum tree_code) (t1)->base.code) == UNION_TYPE || ((enum tree_code
) (t1)->base.code) == QUAL_UNION_TYPE) ? ((tree_class_check
((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1372, __FUNCTION__))->type_non_common.lang_1) : (tree) __null
)
&& TYPE_TEMPLATE_INFO (t2)(((enum tree_code) (t2)->base.code) == ENUMERAL_TYPE || ((
enum tree_code) (t2)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| (((enum tree_code) (t2)->base.code) == RECORD_TYPE || (
(enum tree_code) (t2)->base.code) == UNION_TYPE || ((enum tree_code
) (t2)->base.code) == QUAL_UNION_TYPE) ? ((tree_class_check
((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1372, __FUNCTION__))->type_non_common.lang_1) : (tree) __null
)
1373 && (TYPE_TI_TEMPLATE (t1)(((struct tree_template_info*)(tree_check (((((enum tree_code
) (t1)->base.code) == ENUMERAL_TYPE || ((enum tree_code) (
t1)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || (((enum
tree_code) (t1)->base.code) == RECORD_TYPE || ((enum tree_code
) (t1)->base.code) == UNION_TYPE || ((enum tree_code) (t1)
->base.code) == QUAL_UNION_TYPE) ? ((tree_class_check ((t1
), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1373, __FUNCTION__))->type_non_common.lang_1) : (tree) __null
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1373, __FUNCTION__, (TEMPLATE_INFO))))->tmpl)
== TYPE_TI_TEMPLATE (t2)(((struct tree_template_info*)(tree_check (((((enum tree_code
) (t2)->base.code) == ENUMERAL_TYPE || ((enum tree_code) (
t2)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || (((enum
tree_code) (t2)->base.code) == RECORD_TYPE || ((enum tree_code
) (t2)->base.code) == UNION_TYPE || ((enum tree_code) (t2)
->base.code) == QUAL_UNION_TYPE) ? ((tree_class_check ((t2
), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1373, __FUNCTION__))->type_non_common.lang_1) : (tree) __null
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1373, __FUNCTION__, (TEMPLATE_INFO))))->tmpl)
1374 || TREE_CODE (t1)((enum tree_code) (t1)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM)
1375 && comp_template_args (TYPE_TI_ARGS (t1)(((struct tree_template_info*)(tree_check (((((enum tree_code
) (t1)->base.code) == ENUMERAL_TYPE || ((enum tree_code) (
t1)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || (((enum
tree_code) (t1)->base.code) == RECORD_TYPE || ((enum tree_code
) (t1)->base.code) == UNION_TYPE || ((enum tree_code) (t1)
->base.code) == QUAL_UNION_TYPE) ? ((tree_class_check ((t1
), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1375, __FUNCTION__))->type_non_common.lang_1) : (tree) __null
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1375, __FUNCTION__, (TEMPLATE_INFO))))->args)
, TYPE_TI_ARGS (t2)(((struct tree_template_info*)(tree_check (((((enum tree_code
) (t2)->base.code) == ENUMERAL_TYPE || ((enum tree_code) (
t2)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM || (((enum
tree_code) (t2)->base.code) == RECORD_TYPE || ((enum tree_code
) (t2)->base.code) == UNION_TYPE || ((enum tree_code) (t2)
->base.code) == QUAL_UNION_TYPE) ? ((tree_class_check ((t2
), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1375, __FUNCTION__))->type_non_common.lang_1) : (tree) __null
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1375, __FUNCTION__, (TEMPLATE_INFO))))->args)
))
1376 break;
1377
1378 if ((strict & COMPARE_BASE1) && DERIVED_FROM_P (t1, t2)(lookup_base ((t2), (t1), ba_any, __null, tf_none) != (tree) __null
)
)
1379 break;
1380 else if ((strict & COMPARE_DERIVED2) && DERIVED_FROM_P (t2, t1)(lookup_base ((t1), (t2), ba_any, __null, tf_none) != (tree) __null
)
)
1381 break;
1382
1383 return false;
1384
1385 case OFFSET_TYPE:
1386 if (!comptypes (TYPE_OFFSET_BASETYPE (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1386, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
)
, TYPE_OFFSET_BASETYPE (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1386, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
)
,
1387 strict & ~COMPARE_REDECLARATION4))
1388 return false;
1389 if (!same_type_p (TREE_TYPE (t1), TREE_TYPE (t2))comptypes ((((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1389, __FUNCTION__))->typed.type)), (((contains_struct_check
((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1389, __FUNCTION__))->typed.type)), 0)
)
1390 return false;
1391 break;
1392
1393 case REFERENCE_TYPE:
1394 if (TYPE_REF_IS_RVALUE (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1394, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
!= TYPE_REF_IS_RVALUE (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1394, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
)
1395 return false;
1396 /* fall through to checks for pointer types */
1397 gcc_fallthrough ();
1398
1399 case POINTER_TYPE:
1400 if (TYPE_MODE (t1)((((enum tree_code) ((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1400, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(t1) : (t1)->type_common.mode)
!= TYPE_MODE (t2)((((enum tree_code) ((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1400, __FUNCTION__)))->base.code) == VECTOR_TYPE) ? vector_type_mode
(t2) : (t2)->type_common.mode)
1401 || !same_type_p (TREE_TYPE (t1), TREE_TYPE (t2))comptypes ((((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1401, __FUNCTION__))->typed.type)), (((contains_struct_check
((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1401, __FUNCTION__))->typed.type)), 0)
)
1402 return false;
1403 break;
1404
1405 case METHOD_TYPE:
1406 case FUNCTION_TYPE:
1407 /* Exception specs and memfn_rquals were checked above. */
1408 if (!same_type_p (TREE_TYPE (t1), TREE_TYPE (t2))comptypes ((((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1408, __FUNCTION__))->typed.type)), (((contains_struct_check
((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1408, __FUNCTION__))->typed.type)), 0)
)
1409 return false;
1410 if (!compparms (TYPE_ARG_TYPES (t1)((tree_check2 ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1410, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)
, TYPE_ARG_TYPES (t2)((tree_check2 ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1410, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)
))
1411 return false;
1412 break;
1413
1414 case ARRAY_TYPE:
1415 /* Target types must match incl. qualifiers. */
1416 if (!comp_array_types (t1, t2, ((strict & COMPARE_REDECLARATION4)
1417 ? bounds_either : bounds_none),
1418 /*strict=*/true))
1419 return false;
1420 break;
1421
1422 case TEMPLATE_TYPE_PARM:
1423 /* If T1 and T2 don't have the same relative position in their
1424 template parameters set, they can't be equal. */
1425 if (!comp_template_parms_position (t1, t2))
1426 return false;
1427 /* If T1 and T2 don't represent the same class template deduction,
1428 they aren't equal. */
1429 if (CLASS_PLACEHOLDER_TEMPLATE (t1)(((contains_struct_check ((((tree_class_check (((tree_check (
(t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1429, __FUNCTION__, (TEMPLATE_TYPE_PARM)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1429, __FUNCTION__))->type_common.name)), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1429, __FUNCTION__))->decl_common.initial))
1430 != CLASS_PLACEHOLDER_TEMPLATE (t2)(((contains_struct_check ((((tree_class_check (((tree_check (
(t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1430, __FUNCTION__, (TEMPLATE_TYPE_PARM)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1430, __FUNCTION__))->type_common.name)), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1430, __FUNCTION__))->decl_common.initial))
)
1431 return false;
1432 /* Constrained 'auto's are distinct from parms that don't have the same
1433 constraints. */
1434 if (!equivalent_placeholder_constraints (t1, t2))
1435 return false;
1436 break;
1437
1438 case TYPENAME_TYPE:
1439 if (!cp_tree_equal (TYPENAME_TYPE_FULLNAME (t1)(((tree_class_check (((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1439, __FUNCTION__, (TYPENAME_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1439, __FUNCTION__))->type_non_common.values))
,
1440 TYPENAME_TYPE_FULLNAME (t2)(((tree_class_check (((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1440, __FUNCTION__, (TYPENAME_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1440, __FUNCTION__))->type_non_common.values))
))
1441 return false;
1442 /* Qualifiers don't matter on scopes. */
1443 if (!same_type_ignoring_top_level_qualifiers_p (TYPE_CONTEXT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1443, __FUNCTION__))->type_common.context)
,
1444 TYPE_CONTEXT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1444, __FUNCTION__))->type_common.context)
))
1445 return false;
1446 break;
1447
1448 case UNBOUND_CLASS_TEMPLATE:
1449 if (!cp_tree_equal (TYPE_IDENTIFIER (t1)(((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1449, __FUNCTION__))->type_common.name) && (tree_code_type
[(int) (((enum tree_code) (((tree_class_check ((t1), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1449, __FUNCTION__))->type_common.name))->base.code))
] == tcc_declaration) ? ((contains_struct_check ((((tree_class_check
((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1449, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1449, __FUNCTION__))->decl_minimal.name) : ((tree_class_check
((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1449, __FUNCTION__))->type_common.name))
, TYPE_IDENTIFIER (t2)(((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1449, __FUNCTION__))->type_common.name) && (tree_code_type
[(int) (((enum tree_code) (((tree_class_check ((t2), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1449, __FUNCTION__))->type_common.name))->base.code))
] == tcc_declaration) ? ((contains_struct_check ((((tree_class_check
((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1449, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1449, __FUNCTION__))->decl_minimal.name) : ((tree_class_check
((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1449, __FUNCTION__))->type_common.name))
))
1450 return false;
1451 if (!same_type_p (TYPE_CONTEXT (t1), TYPE_CONTEXT (t2))comptypes ((((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1451, __FUNCTION__))->type_common.context)), (((tree_class_check
((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1451, __FUNCTION__))->type_common.context)), 0)
)
1452 return false;
1453 break;
1454
1455 case COMPLEX_TYPE:
1456 if (!same_type_p (TREE_TYPE (t1), TREE_TYPE (t2))comptypes ((((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1456, __FUNCTION__))->typed.type)), (((contains_struct_check
((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1456, __FUNCTION__))->typed.type)), 0)
)
1457 return false;
1458 break;
1459
1460 case VECTOR_TYPE:
1461 if (gnu_vector_type_p (t1) != gnu_vector_type_p (t2)
1462 || maybe_ne (TYPE_VECTOR_SUBPARTS (t1), TYPE_VECTOR_SUBPARTS (t2))
1463 || !same_type_p (TREE_TYPE (t1), TREE_TYPE (t2))comptypes ((((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1463, __FUNCTION__))->typed.type)), (((contains_struct_check
((t2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1463, __FUNCTION__))->typed.type)), 0)
)
1464 return false;
1465 break;
1466
1467 case TYPE_PACK_EXPANSION:
1468 return (same_type_p (PACK_EXPANSION_PATTERN (t1),comptypes (((((enum tree_code) (t1)->base.code) == TYPE_PACK_EXPANSION
? ((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1468, __FUNCTION__))->typed.type) : (*((const_cast<tree
*> (tree_operand_check ((t1), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1468, __FUNCTION__))))))), ((((enum tree_code) (t2)->base
.code) == TYPE_PACK_EXPANSION ? ((contains_struct_check ((t2)
, (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1469, __FUNCTION__))->typed.type) : (*((const_cast<tree
*> (tree_operand_check ((t2), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1469, __FUNCTION__))))))), 0)
1469 PACK_EXPANSION_PATTERN (t2))comptypes (((((enum tree_code) (t1)->base.code) == TYPE_PACK_EXPANSION
? ((contains_struct_check ((t1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1468, __FUNCTION__))->typed.type) : (*((const_cast<tree
*> (tree_operand_check ((t1), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1468, __FUNCTION__))))))), ((((enum tree_code) (t2)->base
.code) == TYPE_PACK_EXPANSION ? ((contains_struct_check ((t2)
, (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1469, __FUNCTION__))->typed.type) : (*((const_cast<tree
*> (tree_operand_check ((t2), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1469, __FUNCTION__))))))), 0)
1470 && comp_template_args (PACK_EXPANSION_EXTRA_ARGS (t1)*(((enum tree_code) (t1)->base.code) == TYPE_PACK_EXPANSION
? &((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1470, __FUNCTION__))->type_non_common.maxval) : &(*(
(const_cast<tree*> (tree_operand_check (((t1)), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1470, __FUNCTION__))))))
,
1471 PACK_EXPANSION_EXTRA_ARGS (t2)*(((enum tree_code) (t2)->base.code) == TYPE_PACK_EXPANSION
? &((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1471, __FUNCTION__))->type_non_common.maxval) : &(*(
(const_cast<tree*> (tree_operand_check (((t2)), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1471, __FUNCTION__))))))
));
1472
1473 case DECLTYPE_TYPE:
1474 if (DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (t1)((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1474, __FUNCTION__, (DECLTYPE_TYPE))))->type_common.string_flag
1475 != DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (t2)((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1475, __FUNCTION__, (DECLTYPE_TYPE))))->type_common.string_flag
)
1476 return false;
1477 if (DECLTYPE_FOR_LAMBDA_CAPTURE (t1)((tree_not_check2 (((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1477, __FUNCTION__, (DECLTYPE_TYPE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1477, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)
!= DECLTYPE_FOR_LAMBDA_CAPTURE (t2)((tree_not_check2 (((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1477, __FUNCTION__, (DECLTYPE_TYPE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1477, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)
)
1478 return false;
1479 if (DECLTYPE_FOR_LAMBDA_PROXY (t1)((tree_not_check2 (((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1479, __FUNCTION__, (DECLTYPE_TYPE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1479, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)
!= DECLTYPE_FOR_LAMBDA_PROXY (t2)((tree_not_check2 (((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1479, __FUNCTION__, (DECLTYPE_TYPE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1479, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)
)
1480 return false;
1481 if (!cp_tree_equal (DECLTYPE_TYPE_EXPR (t1)(((tree_class_check (((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1481, __FUNCTION__, (DECLTYPE_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1481, __FUNCTION__))->type_non_common.values))
, DECLTYPE_TYPE_EXPR (t2)(((tree_class_check (((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1481, __FUNCTION__, (DECLTYPE_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1481, __FUNCTION__))->type_non_common.values))
))
1482 return false;
1483 break;
1484
1485 case UNDERLYING_TYPE:
1486 if (!same_type_p (UNDERLYING_TYPE_TYPE (t1), UNDERLYING_TYPE_TYPE (t2))comptypes (((((tree_class_check (((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1486, __FUNCTION__, (UNDERLYING_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1486, __FUNCTION__))->type_non_common.values))), ((((tree_class_check
(((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1486, __FUNCTION__, (UNDERLYING_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1486, __FUNCTION__))->type_non_common.values))), 0)
)
1487 return false;
1488 break;
1489
1490 case TYPEOF_TYPE:
1491 if (!cp_tree_equal (TYPEOF_TYPE_EXPR (t1)(((tree_class_check (((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1491, __FUNCTION__, (TYPEOF_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1491, __FUNCTION__))->type_non_common.values))
, TYPEOF_TYPE_EXPR (t2)(((tree_class_check (((tree_check ((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1491, __FUNCTION__, (TYPEOF_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1491, __FUNCTION__))->type_non_common.values))
))
1492 return false;
1493 break;
1494
1495 default:
1496 return false;
1497 }
1498
1499 /* If we get here, we know that from a target independent POV the
1500 types are the same. Make sure the target attributes are also
1501 the same. */
1502 if (!comp_type_attributes (t1, t2))
1503 return false;
1504
1505 check_alias:
1506 if (comparing_dependent_aliases)
1507 {
1508 /* Don't treat an alias template specialization with dependent
1509 arguments as equivalent to its underlying type when used as a
1510 template argument; we need them to be distinct so that we
1511 substitute into the specialization arguments at instantiation
1512 time. And aliases can't be equivalent without being ==, so
1513 we don't need to look any deeper. */
1514 tree dep1 = dependent_alias_template_spec_p (t1, nt_transparent);
1515 tree dep2 = dependent_alias_template_spec_p (t2, nt_transparent);
1516 if ((dep1 || dep2) && dep1 != dep2)
1517 return false;
1518 }
1519
1520 return true;
1521}
1522
1523/* Return true if T1 and T2 are related as allowed by STRICT. STRICT
1524 is a bitwise-or of the COMPARE_* flags. */
1525
1526bool
1527comptypes (tree t1, tree t2, int strict)
1528{
1529 gcc_checking_assert (t1 && t2)((void)(!(t1 && t2) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1529, __FUNCTION__), 0 : 0))
;
1530
1531 /* TYPE_ARGUMENT_PACKS are not really types. */
1532 gcc_checking_assert (TREE_CODE (t1) != TYPE_ARGUMENT_PACK((void)(!(((enum tree_code) (t1)->base.code) != TYPE_ARGUMENT_PACK
&& ((enum tree_code) (t2)->base.code) != TYPE_ARGUMENT_PACK
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1533, __FUNCTION__), 0 : 0))
1533 && TREE_CODE (t2) != TYPE_ARGUMENT_PACK)((void)(!(((enum tree_code) (t1)->base.code) != TYPE_ARGUMENT_PACK
&& ((enum tree_code) (t2)->base.code) != TYPE_ARGUMENT_PACK
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1533, __FUNCTION__), 0 : 0))
;
1534
1535 if (t1 == t2)
1536 return true;
1537
1538 /* Suppress errors caused by previously reported errors. */
1539 if (t1 == error_mark_nodeglobal_trees[TI_ERROR_MARK] || t2 == error_mark_nodeglobal_trees[TI_ERROR_MARK])
1540 return false;
1541
1542 if (strict == COMPARE_STRICT0)
1543 {
1544 if (TYPE_STRUCTURAL_EQUALITY_P (t1)(((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1544, __FUNCTION__))->type_common.canonical) == (tree) __null
)
|| TYPE_STRUCTURAL_EQUALITY_P (t2)(((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1544, __FUNCTION__))->type_common.canonical) == (tree) __null
)
)
1545 /* At least one of the types requires structural equality, so
1546 perform a deep check. */
1547 return structural_comptypes (t1, t2, strict);
1548
1549 if (flag_checkingglobal_options.x_flag_checking && param_use_canonical_typesglobal_options.x_param_use_canonical_types)
1550 {
1551 bool result = structural_comptypes (t1, t2, strict);
1552
1553 if (result && TYPE_CANONICAL (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1553, __FUNCTION__))->type_common.canonical)
!= TYPE_CANONICAL (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1553, __FUNCTION__))->type_common.canonical)
)
1554 /* The two types are structurally equivalent, but their
1555 canonical types were different. This is a failure of the
1556 canonical type propagation code.*/
1557 internal_error
1558 ("canonical types differ for identical types %qT and %qT",
1559 t1, t2);
1560 else if (!result && TYPE_CANONICAL (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1560, __FUNCTION__))->type_common.canonical)
== TYPE_CANONICAL (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1560, __FUNCTION__))->type_common.canonical)
)
1561 /* Two types are structurally different, but the canonical
1562 types are the same. This means we were over-eager in
1563 assigning canonical types. */
1564 internal_error
1565 ("same canonical type node for different types %qT and %qT",
1566 t1, t2);
1567
1568 return result;
1569 }
1570 if (!flag_checkingglobal_options.x_flag_checking && param_use_canonical_typesglobal_options.x_param_use_canonical_types)
1571 return TYPE_CANONICAL (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1571, __FUNCTION__))->type_common.canonical)
== TYPE_CANONICAL (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1571, __FUNCTION__))->type_common.canonical)
;
1572 else
1573 return structural_comptypes (t1, t2, strict);
1574 }
1575 else if (strict == COMPARE_STRUCTURAL8)
1576 return structural_comptypes (t1, t2, COMPARE_STRICT0);
1577 else
1578 return structural_comptypes (t1, t2, strict);
1579}
1580
1581/* Returns nonzero iff TYPE1 and TYPE2 are the same type, ignoring
1582 top-level qualifiers. */
1583
1584bool
1585same_type_ignoring_top_level_qualifiers_p (tree type1, tree type2)
1586{
1587 if (type1 == error_mark_nodeglobal_trees[TI_ERROR_MARK] || type2 == error_mark_nodeglobal_trees[TI_ERROR_MARK])
1588 return false;
1589 if (type1 == type2)
1590 return true;
1591
1592 type1 = cp_build_qualified_type (type1, TYPE_UNQUALIFIED)cp_build_qualified_type_real ((type1), (TYPE_UNQUALIFIED), tf_warning_or_error
)
;
1593 type2 = cp_build_qualified_type (type2, TYPE_UNQUALIFIED)cp_build_qualified_type_real ((type2), (TYPE_UNQUALIFIED), tf_warning_or_error
)
;
1594 return same_type_p (type1, type2)comptypes ((type1), (type2), 0);
1595}
1596
1597/* Returns nonzero iff TYPE1 and TYPE2 are similar, as per [conv.qual]. */
1598
1599bool
1600similar_type_p (tree type1, tree type2)
1601{
1602 if (type1 == error_mark_nodeglobal_trees[TI_ERROR_MARK] || type2 == error_mark_nodeglobal_trees[TI_ERROR_MARK])
1603 return false;
1604
1605 /* Informally, two types are similar if, ignoring top-level cv-qualification:
1606 * they are the same type; or
1607 * they are both pointers, and the pointed-to types are similar; or
1608 * they are both pointers to member of the same class, and the types of
1609 the pointed-to members are similar; or
1610 * they are both arrays of the same size or both arrays of unknown bound,
1611 and the array element types are similar. */
1612
1613 if (same_type_ignoring_top_level_qualifiers_p (type1, type2))
1614 return true;
1615
1616 if ((TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE) && TYPE_PTR_P (type2)(((enum tree_code) (type2)->base.code) == POINTER_TYPE))
1617 || (TYPE_PTRDATAMEM_P (type1)(((enum tree_code) (type1)->base.code) == OFFSET_TYPE) && TYPE_PTRDATAMEM_P (type2)(((enum tree_code) (type2)->base.code) == OFFSET_TYPE))
1618 || (TREE_CODE (type1)((enum tree_code) (type1)->base.code) == ARRAY_TYPE && TREE_CODE (type2)((enum tree_code) (type2)->base.code) == ARRAY_TYPE))
1619 return comp_ptr_ttypes_const (type1, type2, bounds_either);
1620
1621 return false;
1622}
1623
1624/* Helper function for layout_compatible_type_p and
1625 is_corresponding_member_aggr. Advance to next members (NULL if
1626 no further ones) and return true if those members are still part of
1627 the common initial sequence. */
1628
1629bool
1630next_common_initial_seqence (tree &memb1, tree &memb2)
1631{
1632 while (memb1)
1633 {
1634 if (TREE_CODE (memb1)((enum tree_code) (memb1)->base.code) != FIELD_DECL
1635 || (DECL_FIELD_IS_BASE (memb1)((contains_struct_check (((tree_check ((memb1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1635, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1635, __FUNCTION__))->decl_common.lang_flag_6)
&& is_empty_field (memb1)))
1636 {
1637 memb1 = DECL_CHAIN (memb1)(((contains_struct_check (((contains_struct_check ((memb1), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1637, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1637, __FUNCTION__))->common.chain))
;
1638 continue;
1639 }
1640 if (DECL_FIELD_IS_BASE (memb1)((contains_struct_check (((tree_check ((memb1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1640, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1640, __FUNCTION__))->decl_common.lang_flag_6)
)
1641 {
1642 memb1 = TYPE_FIELDS (TREE_TYPE (memb1))((tree_check3 ((((contains_struct_check ((memb1), (TS_TYPED),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1642, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1642, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
;
1643 continue;
1644 }
1645 break;
1646 }
1647 while (memb2)
1648 {
1649 if (TREE_CODE (memb2)((enum tree_code) (memb2)->base.code) != FIELD_DECL
1650 || (DECL_FIELD_IS_BASE (memb2)((contains_struct_check (((tree_check ((memb2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1650, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1650, __FUNCTION__))->decl_common.lang_flag_6)
&& is_empty_field (memb2)))
1651 {
1652 memb2 = DECL_CHAIN (memb2)(((contains_struct_check (((contains_struct_check ((memb2), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1652, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1652, __FUNCTION__))->common.chain))
;
1653 continue;
1654 }
1655 if (DECL_FIELD_IS_BASE (memb2)((contains_struct_check (((tree_check ((memb2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1655, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1655, __FUNCTION__))->decl_common.lang_flag_6)
)
1656 {
1657 memb2 = TYPE_FIELDS (TREE_TYPE (memb2))((tree_check3 ((((contains_struct_check ((memb2), (TS_TYPED),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1657, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1657, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
;
1658 continue;
1659 }
1660 break;
1661 }
1662 if (memb1 == NULL_TREE(tree) __null && memb2 == NULL_TREE(tree) __null)
1663 return true;
1664 if (memb1 == NULL_TREE(tree) __null || memb2 == NULL_TREE(tree) __null)
1665 return false;
1666 if (DECL_BIT_FIELD_TYPE (memb1)((tree_check ((memb1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1666, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_field_type
)
)
1667 {
1668 if (!DECL_BIT_FIELD_TYPE (memb2)((tree_check ((memb2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1668, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_field_type
)
)
1669 return false;
1670 if (!layout_compatible_type_p (DECL_BIT_FIELD_TYPE (memb1)((tree_check ((memb1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1670, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_field_type
)
,
1671 DECL_BIT_FIELD_TYPE (memb2)((tree_check ((memb2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1671, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_field_type
)
))
1672 return false;
1673 if (TYPE_PRECISION (TREE_TYPE (memb1))((tree_class_check ((((contains_struct_check ((memb1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1673, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1673, __FUNCTION__))->type_common.precision)
1674 != TYPE_PRECISION (TREE_TYPE (memb2))((tree_class_check ((((contains_struct_check ((memb2), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1674, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1674, __FUNCTION__))->type_common.precision)
)
1675 return false;
1676 }
1677 else if (DECL_BIT_FIELD_TYPE (memb2)((tree_check ((memb2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1677, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_field_type
)
)
1678 return false;
1679 else if (!layout_compatible_type_p (TREE_TYPE (memb1)((contains_struct_check ((memb1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1679, __FUNCTION__))->typed.type)
, TREE_TYPE (memb2)((contains_struct_check ((memb2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1679, __FUNCTION__))->typed.type)
))
1680 return false;
1681 if ((!lookup_attribute ("no_unique_address", DECL_ATTRIBUTES (memb1)((contains_struct_check ((memb1), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1681, __FUNCTION__))->decl_common.attributes)
))
1682 != !lookup_attribute ("no_unique_address", DECL_ATTRIBUTES (memb2)((contains_struct_check ((memb2), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1682, __FUNCTION__))->decl_common.attributes)
))
1683 return false;
1684 if (!tree_int_cst_equal (bit_position (memb1), bit_position (memb2)))
1685 return false;
1686 return true;
1687}
1688
1689/* Return true if TYPE1 and TYPE2 are layout-compatible types. */
1690
1691bool
1692layout_compatible_type_p (tree type1, tree type2)
1693{
1694 if (type1 == error_mark_nodeglobal_trees[TI_ERROR_MARK] || type2 == error_mark_nodeglobal_trees[TI_ERROR_MARK])
1695 return false;
1696 if (type1 == type2)
1697 return true;
1698 if (TREE_CODE (type1)((enum tree_code) (type1)->base.code) != TREE_CODE (type2)((enum tree_code) (type2)->base.code))
1699 return false;
1700
1701 type1 = cp_build_qualified_type (type1, TYPE_UNQUALIFIED)cp_build_qualified_type_real ((type1), (TYPE_UNQUALIFIED), tf_warning_or_error
)
;
1702 type2 = cp_build_qualified_type (type2, TYPE_UNQUALIFIED)cp_build_qualified_type_real ((type2), (TYPE_UNQUALIFIED), tf_warning_or_error
)
;
1703
1704 if (TREE_CODE (type1)((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE)
1705 return (TYPE_ALIGN (type1)(((tree_class_check ((type1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1705, __FUNCTION__))->type_common.align) ? ((unsigned)1)
<< (((tree_class_check ((type1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1705, __FUNCTION__))->type_common.align) - 1) : 0)
== TYPE_ALIGN (type2)(((tree_class_check ((type2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1705, __FUNCTION__))->type_common.align) ? ((unsigned)1)
<< (((tree_class_check ((type2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1705, __FUNCTION__))->type_common.align) - 1) : 0)
1706 && tree_int_cst_equal (TYPE_SIZE (type1)((tree_class_check ((type1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1706, __FUNCTION__))->type_common.size)
, TYPE_SIZE (type2)((tree_class_check ((type2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1706, __FUNCTION__))->type_common.size)
)
1707 && same_type_p (finish_underlying_type (type1),comptypes ((finish_underlying_type (type1)), (finish_underlying_type
(type2)), 0)
1708 finish_underlying_type (type2))comptypes ((finish_underlying_type (type1)), (finish_underlying_type
(type2)), 0)
);
1709
1710 if (CLASS_TYPE_P (type1)(((((enum tree_code) (type1)->base.code)) == RECORD_TYPE ||
(((enum tree_code) (type1)->base.code)) == UNION_TYPE) &&
((tree_class_check ((type1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1710, __FUNCTION__))->type_common.lang_flag_5))
1711 && std_layout_type_p (type1)
1712 && std_layout_type_p (type2)
1713 && TYPE_ALIGN (type1)(((tree_class_check ((type1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1713, __FUNCTION__))->type_common.align) ? ((unsigned)1)
<< (((tree_class_check ((type1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1713, __FUNCTION__))->type_common.align) - 1) : 0)
== TYPE_ALIGN (type2)(((tree_class_check ((type2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1713, __FUNCTION__))->type_common.align) ? ((unsigned)1)
<< (((tree_class_check ((type2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1713, __FUNCTION__))->type_common.align) - 1) : 0)
1714 && tree_int_cst_equal (TYPE_SIZE (type1)((tree_class_check ((type1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1714, __FUNCTION__))->type_common.size)
, TYPE_SIZE (type2)((tree_class_check ((type2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1714, __FUNCTION__))->type_common.size)
))
1715 {
1716 tree field1 = TYPE_FIELDS (type1)((tree_check3 ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1716, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
;
1717 tree field2 = TYPE_FIELDS (type2)((tree_check3 ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1717, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
;
1718 if (TREE_CODE (type1)((enum tree_code) (type1)->base.code) == RECORD_TYPE)
1719 {
1720 while (1)
1721 {
1722 if (!next_common_initial_seqence (field1, field2))
1723 return false;
1724 if (field1 == NULL_TREE(tree) __null)
1725 return true;
1726 field1 = DECL_CHAIN (field1)(((contains_struct_check (((contains_struct_check ((field1), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1726, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1726, __FUNCTION__))->common.chain))
;
1727 field2 = DECL_CHAIN (field2)(((contains_struct_check (((contains_struct_check ((field2), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1727, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1727, __FUNCTION__))->common.chain))
;
1728 }
1729 }
1730 /* Otherwise both types must be union types.
1731 The standard says:
1732 "Two standard-layout unions are layout-compatible if they have
1733 the same number of non-static data members and corresponding
1734 non-static data members (in any order) have layout-compatible
1735 types."
1736 but the code anticipates that bitfield vs. non-bitfield,
1737 different bitfield widths or presence/absence of
1738 [[no_unique_address]] should be checked as well. */
1739 auto_vec<tree, 16> vec;
1740 unsigned int count = 0;
1741 for (; field1; field1 = DECL_CHAIN (field1)(((contains_struct_check (((contains_struct_check ((field1), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1741, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1741, __FUNCTION__))->common.chain))
)
1742 if (TREE_CODE (field1)((enum tree_code) (field1)->base.code) == FIELD_DECL)
1743 count++;
1744 for (; field2; field2 = DECL_CHAIN (field2)(((contains_struct_check (((contains_struct_check ((field2), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1744, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1744, __FUNCTION__))->common.chain))
)
1745 if (TREE_CODE (field2)((enum tree_code) (field2)->base.code) == FIELD_DECL)
1746 vec.safe_push (field2);
1747 /* Discussions on core lean towards treating multiple union fields
1748 of the same type as the same field, so this might need changing
1749 in the future. */
1750 if (count != vec.length ())
1751 return false;
1752 for (field1 = TYPE_FIELDS (type1)((tree_check3 ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1752, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
; field1; field1 = DECL_CHAIN (field1)(((contains_struct_check (((contains_struct_check ((field1), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1752, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1752, __FUNCTION__))->common.chain))
)
1753 {
1754 if (TREE_CODE (field1)((enum tree_code) (field1)->base.code) != FIELD_DECL)
1755 continue;
1756 unsigned int j;
1757 tree t1 = DECL_BIT_FIELD_TYPE (field1)((tree_check ((field1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1757, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_field_type
)
;
1758 if (t1 == NULL_TREE(tree) __null)
1759 t1 = TREE_TYPE (field1)((contains_struct_check ((field1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1759, __FUNCTION__))->typed.type)
;
1760 FOR_EACH_VEC_ELT (vec, j, field2)for (j = 0; (vec).iterate ((j), &(field2)); ++(j))
1761 {
1762 tree t2 = DECL_BIT_FIELD_TYPE (field2)((tree_check ((field2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1762, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_field_type
)
;
1763 if (t2 == NULL_TREE(tree) __null)
1764 t2 = TREE_TYPE (field2)((contains_struct_check ((field2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1764, __FUNCTION__))->typed.type)
;
1765 if (DECL_BIT_FIELD_TYPE (field1)((tree_check ((field1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1765, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_field_type
)
)
1766 {
1767 if (!DECL_BIT_FIELD_TYPE (field2)((tree_check ((field2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1767, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_field_type
)
)
1768 continue;
1769 if (TYPE_PRECISION (TREE_TYPE (field1))((tree_class_check ((((contains_struct_check ((field1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1769, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1769, __FUNCTION__))->type_common.precision)
1770 != TYPE_PRECISION (TREE_TYPE (field2))((tree_class_check ((((contains_struct_check ((field2), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1770, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1770, __FUNCTION__))->type_common.precision)
)
1771 continue;
1772 }
1773 else if (DECL_BIT_FIELD_TYPE (field2)((tree_check ((field2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1773, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_field_type
)
)
1774 continue;
1775 if (!layout_compatible_type_p (t1, t2))
1776 continue;
1777 if ((!lookup_attribute ("no_unique_address",
1778 DECL_ATTRIBUTES (field1)((contains_struct_check ((field1), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1778, __FUNCTION__))->decl_common.attributes)
))
1779 != !lookup_attribute ("no_unique_address",
1780 DECL_ATTRIBUTES (field2)((contains_struct_check ((field2), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1780, __FUNCTION__))->decl_common.attributes)
))
1781 continue;
1782 break;
1783 }
1784 if (j == vec.length ())
1785 return false;
1786 vec.unordered_remove (j);
1787 }
1788 return true;
1789 }
1790
1791 return same_type_p (type1, type2)comptypes ((type1), (type2), 0);
1792}
1793
1794/* Returns 1 if TYPE1 is at least as qualified as TYPE2. */
1795
1796bool
1797at_least_as_qualified_p (const_tree type1, const_tree type2)
1798{
1799 int q1 = cp_type_quals (type1);
1800 int q2 = cp_type_quals (type2);
1801
1802 /* All qualifiers for TYPE2 must also appear in TYPE1. */
1803 return (q1 & q2) == q2;
1804}
1805
1806/* Returns 1 if TYPE1 is more cv-qualified than TYPE2, -1 if TYPE2 is
1807 more cv-qualified that TYPE1, and 0 otherwise. */
1808
1809int
1810comp_cv_qualification (int q1, int q2)
1811{
1812 if (q1 == q2)
1813 return 0;
1814
1815 if ((q1 & q2) == q2)
1816 return 1;
1817 else if ((q1 & q2) == q1)
1818 return -1;
1819
1820 return 0;
1821}
1822
1823int
1824comp_cv_qualification (const_tree type1, const_tree type2)
1825{
1826 int q1 = cp_type_quals (type1);
1827 int q2 = cp_type_quals (type2);
1828 return comp_cv_qualification (q1, q2);
1829}
1830
1831/* Returns 1 if the cv-qualification signature of TYPE1 is a proper
1832 subset of the cv-qualification signature of TYPE2, and the types
1833 are similar. Returns -1 if the other way 'round, and 0 otherwise. */
1834
1835int
1836comp_cv_qual_signature (tree type1, tree type2)
1837{
1838 if (comp_ptr_ttypes_real (type2, type1, -1))
1839 return 1;
1840 else if (comp_ptr_ttypes_real (type1, type2, -1))
1841 return -1;
1842 else
1843 return 0;
1844}
1845
1846/* Subroutines of `comptypes'. */
1847
1848/* Return true if two parameter type lists PARMS1 and PARMS2 are
1849 equivalent in the sense that functions with those parameter types
1850 can have equivalent types. The two lists must be equivalent,
1851 element by element. */
1852
1853bool
1854compparms (const_tree parms1, const_tree parms2)
1855{
1856 const_tree t1, t2;
1857
1858 /* An unspecified parmlist matches any specified parmlist
1859 whose argument types don't need default promotions. */
1860
1861 for (t1 = parms1, t2 = parms2;
1862 t1 || t2;
1863 t1 = TREE_CHAIN (t1)((contains_struct_check ((t1), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1863, __FUNCTION__))->common.chain)
, t2 = TREE_CHAIN (t2)((contains_struct_check ((t2), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1863, __FUNCTION__))->common.chain)
)
1864 {
1865 /* If one parmlist is shorter than the other,
1866 they fail to match. */
1867 if (!t1 || !t2)
1868 return false;
1869 if (!same_type_p (TREE_VALUE (t1), TREE_VALUE (t2))comptypes ((((tree_check ((t1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1869, __FUNCTION__, (TREE_LIST)))->list.value)), (((tree_check
((t2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1869, __FUNCTION__, (TREE_LIST)))->list.value)), 0)
)
1870 return false;
1871 }
1872 return true;
1873}
1874
1875
1876/* Process a sizeof or alignof expression where the operand is a
1877 type. STD_ALIGNOF indicates whether an alignof has C++11 (minimum alignment)
1878 or GNU (preferred alignment) semantics; it is ignored if op is
1879 SIZEOF_EXPR. */
1880
1881tree
1882cxx_sizeof_or_alignof_type (location_t loc, tree type, enum tree_code op,
1883 bool std_alignof, bool complain)
1884{
1885 gcc_assert (op == SIZEOF_EXPR || op == ALIGNOF_EXPR)((void)(!(op == SIZEOF_EXPR || op == ALIGNOF_EXPR) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1885, __FUNCTION__), 0 : 0))
;
1886 if (type == error_mark_nodeglobal_trees[TI_ERROR_MARK])
1887 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
1888
1889 type = non_reference (type);
1890 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == METHOD_TYPE)
1891 {
1892 if (complain)
1893 {
1894 pedwarn (loc, OPT_Wpointer_arith,
1895 "invalid application of %qs to a member function",
1896 OVL_OP_INFO (false, op)(&ovl_op_info[(false) != 0][ovl_op_mapping[(op)]])->name);
1897 return size_one_nodeglobal_trees[TI_SIZE_ONE];
1898 }
1899 else
1900 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
1901 }
1902
1903 bool dependent_p = dependent_type_p (type);
1904 if (!dependent_p)
1905 complete_type (type);
1906 if (dependent_p
1907 /* VLA types will have a non-constant size. In the body of an
1908 uninstantiated template, we don't need to try to compute the
1909 value, because the sizeof expression is not an integral
1910 constant expression in that case. And, if we do try to
1911 compute the value, we'll likely end up with SAVE_EXPRs, which
1912 the template substitution machinery does not expect to see. */
1913 || (processing_template_declscope_chain->x_processing_template_decl
1914 && COMPLETE_TYPE_P (type)(((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1914, __FUNCTION__))->type_common.size) != (tree) __null
)
1915 && TREE_CODE (TYPE_SIZE (type))((enum tree_code) (((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1915, __FUNCTION__))->type_common.size))->base.code)
!= INTEGER_CST))
1916 {
1917 tree value = build_min (op, size_type_nodeglobal_trees[TI_SIZE_TYPE], type);
1918 TREE_READONLY (value)((non_type_check ((value), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1918, __FUNCTION__))->base.readonly_flag)
= 1;
1919 if (op == ALIGNOF_EXPR && std_alignof)
1920 ALIGNOF_EXPR_STD_P (value)((tree_not_check2 (((tree_check ((value), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1920, __FUNCTION__, (ALIGNOF_EXPR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1920, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)
= true;
1921 SET_EXPR_LOCATION (value, loc)(expr_check (((value)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1921, __FUNCTION__))->exp.locus = (loc)
;
1922 return value;
1923 }
1924
1925 return c_sizeof_or_alignof_type (loc, complete_type (type),
1926 op == SIZEOF_EXPR, std_alignof,
1927 complain);
1928}
1929
1930/* Return the size of the type, without producing any warnings for
1931 types whose size cannot be taken. This routine should be used only
1932 in some other routine that has already produced a diagnostic about
1933 using the size of such a type. */
1934tree
1935cxx_sizeof_nowarn (tree type)
1936{
1937 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == FUNCTION_TYPE
1938 || VOID_TYPE_P (type)(((enum tree_code) (type)->base.code) == VOID_TYPE)
1939 || TREE_CODE (type)((enum tree_code) (type)->base.code) == ERROR_MARK)
1940 return size_one_nodeglobal_trees[TI_SIZE_ONE];
1941 else if (!COMPLETE_TYPE_P (type)(((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1941, __FUNCTION__))->type_common.size) != (tree) __null
)
)
1942 return size_zero_nodeglobal_trees[TI_SIZE_ZERO];
1943 else
1944 return cxx_sizeof_or_alignof_type (input_location, type,
1945 SIZEOF_EXPR, false, false);
1946}
1947
1948/* Process a sizeof expression where the operand is an expression. */
1949
1950static tree
1951cxx_sizeof_expr (location_t loc, tree e, tsubst_flags_t complain)
1952{
1953 if (e == error_mark_nodeglobal_trees[TI_ERROR_MARK])
1954 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
1955
1956 if (instantiation_dependent_uneval_expression_p (e))
1957 {
1958 e = build_min (SIZEOF_EXPR, size_type_nodeglobal_trees[TI_SIZE_TYPE], e);
1959 TREE_SIDE_EFFECTS (e)((non_type_check ((e), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1959, __FUNCTION__))->base.side_effects_flag)
= 0;
1960 TREE_READONLY (e)((non_type_check ((e), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1960, __FUNCTION__))->base.readonly_flag)
= 1;
1961 SET_EXPR_LOCATION (e, loc)(expr_check (((e)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1961, __FUNCTION__))->exp.locus = (loc)
;
1962
1963 return e;
1964 }
1965
1966 location_t e_loc = cp_expr_loc_or_loc (e, loc);
1967 STRIP_ANY_LOCATION_WRAPPER (e)(e) = tree_strip_any_location_wrapper ((const_cast<union tree_node
*> (((e)))))
;
1968
1969 /* To get the size of a static data member declared as an array of
1970 unknown bound, we need to instantiate it. */
1971 if (VAR_P (e)(((enum tree_code) (e)->base.code) == VAR_DECL)
1972 && VAR_HAD_UNKNOWN_BOUND (e)(((contains_struct_check (((tree_check ((e), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1972, __FUNCTION__, (VAR_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1972, __FUNCTION__))->decl_common.lang_specific) ? ((contains_struct_check
((e), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1972, __FUNCTION__))->decl_common.lang_specific)->u.base
.unknown_bound_p : false)
1973 && DECL_TEMPLATE_INSTANTIATION (e)((((contains_struct_check ((e), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1973, __FUNCTION__))->decl_common.lang_specific)->u.base
.use_template) & 1)
)
1974 instantiate_decl (e, /*defer_ok*/true, /*expl_inst_mem*/false);
1975
1976 if (TREE_CODE (e)((enum tree_code) (e)->base.code) == PARM_DECL
1977 && DECL_ARRAY_PARAMETER_P (e)((contains_struct_check (((tree_check ((e), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1977, __FUNCTION__, (PARM_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1977, __FUNCTION__))->decl_common.lang_flag_1)
1978 && (complain & tf_warning))
1979 {
1980 auto_diagnostic_group d;
1981 if (warning_at (e_loc, OPT_Wsizeof_array_argument,
1982 "%<sizeof%> on array function parameter %qE "
1983 "will return size of %qT", e, TREE_TYPE (e)((contains_struct_check ((e), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1983, __FUNCTION__))->typed.type)
))
1984 inform (DECL_SOURCE_LOCATION (e)((contains_struct_check ((e), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 1984, __FUNCTION__))->decl_minimal.locus)
, "declared here");
1985 }
1986
1987 e = mark_type_use (e);
1988
1989 if (bitfield_p (e))
1990 {
1991 if (complain & tf_error)
1992 error_at (e_loc,
1993 "invalid application of %<sizeof%> to a bit-field");
1994 else
1995 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
1996 e = char_type_nodeinteger_types[itk_char];
1997 }
1998 else if (is_overloaded_fn (e))
1999 {
2000 if (complain & tf_error)
2001 permerror (e_loc, "ISO C++ forbids applying %<sizeof%> to "
2002 "an expression of function type");
2003 else
2004 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2005 e = char_type_nodeinteger_types[itk_char];
2006 }
2007 else if (type_unknown_p (e))
2008 {
2009 if (complain & tf_error)
2010 cxx_incomplete_type_error (e_loc, e, TREE_TYPE (e)((contains_struct_check ((e), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2010, __FUNCTION__))->typed.type)
);
2011 else
2012 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2013 e = char_type_nodeinteger_types[itk_char];
2014 }
2015 else
2016 e = TREE_TYPE (e)((contains_struct_check ((e), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2016, __FUNCTION__))->typed.type)
;
2017
2018 return cxx_sizeof_or_alignof_type (loc, e, SIZEOF_EXPR, false,
2019 complain & tf_error);
2020}
2021
2022/* Implement the __alignof keyword: Return the minimum required
2023 alignment of E, measured in bytes. For VAR_DECL's and
2024 FIELD_DECL's return DECL_ALIGN (which can be set from an
2025 "aligned" __attribute__ specification). STD_ALIGNOF acts
2026 like in cxx_sizeof_or_alignof_type. */
2027
2028static tree
2029cxx_alignof_expr (location_t loc, tree e, bool std_alignof,
2030 tsubst_flags_t complain)
2031{
2032 tree t;
2033
2034 if (e == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2035 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2036
2037 if (processing_template_declscope_chain->x_processing_template_decl)
2038 {
2039 e = build_min (ALIGNOF_EXPR, size_type_nodeglobal_trees[TI_SIZE_TYPE], e);
2040 TREE_SIDE_EFFECTS (e)((non_type_check ((e), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2040, __FUNCTION__))->base.side_effects_flag)
= 0;
2041 TREE_READONLY (e)((non_type_check ((e), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2041, __FUNCTION__))->base.readonly_flag)
= 1;
2042 SET_EXPR_LOCATION (e, loc)(expr_check (((e)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2042, __FUNCTION__))->exp.locus = (loc)
;
2043 ALIGNOF_EXPR_STD_P (e)((tree_not_check2 (((tree_check ((e), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2043, __FUNCTION__, (ALIGNOF_EXPR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2043, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)
= std_alignof;
2044
2045 return e;
2046 }
2047
2048 location_t e_loc = cp_expr_loc_or_loc (e, loc);
2049 STRIP_ANY_LOCATION_WRAPPER (e)(e) = tree_strip_any_location_wrapper ((const_cast<union tree_node
*> (((e)))))
;
2050
2051 e = mark_type_use (e);
2052
2053 if (!verify_type_context (loc, TCTX_ALIGNOF, TREE_TYPE (e)((contains_struct_check ((e), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2053, __FUNCTION__))->typed.type)
,
2054 !(complain & tf_error)))
2055 {
2056 if (!(complain & tf_error))
2057 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2058 t = size_one_nodeglobal_trees[TI_SIZE_ONE];
2059 }
2060 else if (VAR_P (e)(((enum tree_code) (e)->base.code) == VAR_DECL))
2061 t = size_int (DECL_ALIGN_UNIT (e))size_int_kind (((((contains_struct_check ((e), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2061, __FUNCTION__))->decl_common.align) ? ((unsigned)1)
<< (((contains_struct_check ((e), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2061, __FUNCTION__))->decl_common.align) - 1) : 0) / (8)
), stk_sizetype)
;
2062 else if (bitfield_p (e))
2063 {
2064 if (complain & tf_error)
2065 error_at (e_loc,
2066 "invalid application of %<__alignof%> to a bit-field");
2067 else
2068 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2069 t = size_one_nodeglobal_trees[TI_SIZE_ONE];
2070 }
2071 else if (TREE_CODE (e)((enum tree_code) (e)->base.code) == COMPONENT_REF
2072 && TREE_CODE (TREE_OPERAND (e, 1))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((e), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2072, __FUNCTION__))))))->base.code)
== FIELD_DECL)
2073 t = size_int (DECL_ALIGN_UNIT (TREE_OPERAND (e, 1)))size_int_kind (((((contains_struct_check (((*((const_cast<
tree*> (tree_operand_check ((e), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2073, __FUNCTION__)))))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2073, __FUNCTION__))->decl_common.align) ? ((unsigned)1)
<< (((contains_struct_check (((*((const_cast<tree*>
(tree_operand_check ((e), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2073, __FUNCTION__)))))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2073, __FUNCTION__))->decl_common.align) - 1) : 0) / (8)
), stk_sizetype)
;
2074 else if (is_overloaded_fn (e))
2075 {
2076 if (complain & tf_error)
2077 permerror (e_loc, "ISO C++ forbids applying %<__alignof%> to "
2078 "an expression of function type");
2079 else
2080 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2081 if (TREE_CODE (e)((enum tree_code) (e)->base.code) == FUNCTION_DECL)
2082 t = size_int (DECL_ALIGN_UNIT (e))size_int_kind (((((contains_struct_check ((e), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2082, __FUNCTION__))->decl_common.align) ? ((unsigned)1)
<< (((contains_struct_check ((e), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2082, __FUNCTION__))->decl_common.align) - 1) : 0) / (8)
), stk_sizetype)
;
2083 else
2084 t = size_one_nodeglobal_trees[TI_SIZE_ONE];
2085 }
2086 else if (type_unknown_p (e))
2087 {
2088 if (complain & tf_error)
2089 cxx_incomplete_type_error (e_loc, e, TREE_TYPE (e)((contains_struct_check ((e), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2089, __FUNCTION__))->typed.type)
);
2090 else
2091 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2092 t = size_one_nodeglobal_trees[TI_SIZE_ONE];
2093 }
2094 else
2095 return cxx_sizeof_or_alignof_type (loc, TREE_TYPE (e)((contains_struct_check ((e), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2095, __FUNCTION__))->typed.type)
,
2096 ALIGNOF_EXPR, std_alignof,
2097 complain & tf_error);
2098
2099 return fold_convert_loc (loc, size_type_nodeglobal_trees[TI_SIZE_TYPE], t);
2100}
2101
2102/* Process a sizeof or alignof expression E with code OP where the operand
2103 is an expression. STD_ALIGNOF acts like in cxx_sizeof_or_alignof_type. */
2104
2105tree
2106cxx_sizeof_or_alignof_expr (location_t loc, tree e, enum tree_code op,
2107 bool std_alignof, bool complain)
2108{
2109 gcc_assert (op == SIZEOF_EXPR || op == ALIGNOF_EXPR)((void)(!(op == SIZEOF_EXPR || op == ALIGNOF_EXPR) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2109, __FUNCTION__), 0 : 0))
;
2110 if (op == SIZEOF_EXPR)
2111 return cxx_sizeof_expr (loc, e, complain? tf_warning_or_error : tf_none);
2112 else
2113 return cxx_alignof_expr (loc, e, std_alignof,
2114 complain? tf_warning_or_error : tf_none);
2115}
2116
2117/* Build a representation of an expression 'alignas(E).' Return the
2118 folded integer value of E if it is an integral constant expression
2119 that resolves to a valid alignment. If E depends on a template
2120 parameter, return a syntactic representation tree of kind
2121 ALIGNOF_EXPR. Otherwise, return an error_mark_node if the
2122 expression is ill formed, or NULL_TREE if E is NULL_TREE. */
2123
2124tree
2125cxx_alignas_expr (tree e)
2126{
2127 if (e == NULL_TREE(tree) __null || e == error_mark_nodeglobal_trees[TI_ERROR_MARK]
2128 || (!TYPE_P (e)(tree_code_type[(int) (((enum tree_code) (e)->base.code))]
== tcc_type)
&& !require_potential_rvalue_constant_expression (e)))
2129 return e;
2130
2131 if (TYPE_P (e)(tree_code_type[(int) (((enum tree_code) (e)->base.code))]
== tcc_type)
)
2132 /* [dcl.align]/3:
2133
2134 When the alignment-specifier is of the form
2135 alignas(type-id ), it shall have the same effect as
2136 alignas(alignof(type-id )). */
2137
2138 return cxx_sizeof_or_alignof_type (input_location,
2139 e, ALIGNOF_EXPR, true, false);
2140
2141 /* If we reach this point, it means the alignas expression if of
2142 the form "alignas(assignment-expression)", so we should follow
2143 what is stated by [dcl.align]/2. */
2144
2145 if (value_dependent_expression_p (e))
2146 /* Leave value-dependent expression alone for now. */
2147 return e;
2148
2149 e = instantiate_non_dependent_expr (e);
2150 e = mark_rvalue_use (e);
2151
2152 /* [dcl.align]/2 says:
2153
2154 the assignment-expression shall be an integral constant
2155 expression. */
2156
2157 if (!INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (TREE_TYPE (e))((((enum tree_code) (((contains_struct_check ((e), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2157, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
&& !((tree_check ((((contains_struct_check ((e), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2157, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2157, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (((contains_struct_check ((e), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2157, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((e), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2157, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
))
)
2158 {
2159 error ("%<alignas%> argument has non-integral type %qT", TREE_TYPE (e)((contains_struct_check ((e), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2159, __FUNCTION__))->typed.type)
);
2160 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2161 }
2162
2163 return cxx_constant_value (e);
2164}
2165
2166
2167/* EXPR is being used in a context that is not a function call.
2168 Enforce:
2169
2170 [expr.ref]
2171
2172 The expression can be used only as the left-hand operand of a
2173 member function call.
2174
2175 [expr.mptr.operator]
2176
2177 If the result of .* or ->* is a function, then that result can be
2178 used only as the operand for the function call operator ().
2179
2180 by issuing an error message if appropriate. Returns true iff EXPR
2181 violates these rules. */
2182
2183bool
2184invalid_nonstatic_memfn_p (location_t loc, tree expr, tsubst_flags_t complain)
2185{
2186 if (expr == NULL_TREE(tree) __null)
2187 return false;
2188 /* Don't enforce this in MS mode. */
2189 if (flag_ms_extensionsglobal_options.x_flag_ms_extensions)
2190 return false;
2191 if (is_overloaded_fn (expr) && !really_overloaded_fn (expr))
2192 expr = get_first_fn (expr);
2193 if (DECL_NONSTATIC_MEMBER_FUNCTION_P (expr)(((enum tree_code) (((contains_struct_check ((expr), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2193, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)
)
2194 {
2195 if (complain & tf_error)
2196 {
2197 if (DECL_P (expr)(tree_code_type[(int) (((enum tree_code) (expr)->base.code
))] == tcc_declaration)
)
2198 {
2199 error_at (loc, "invalid use of non-static member function %qD",
2200 expr);
2201 inform (DECL_SOURCE_LOCATION (expr)((contains_struct_check ((expr), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2201, __FUNCTION__))->decl_minimal.locus)
, "declared here");
2202 }
2203 else
2204 error_at (loc, "invalid use of non-static member function of "
2205 "type %qT", TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2205, __FUNCTION__))->typed.type)
);
2206 }
2207 return true;
2208 }
2209 return false;
2210}
2211
2212/* If EXP is a reference to a bitfield, and the type of EXP does not
2213 match the declared type of the bitfield, return the declared type
2214 of the bitfield. Otherwise, return NULL_TREE. */
2215
2216tree
2217is_bitfield_expr_with_lowered_type (const_tree exp)
2218{
2219 switch (TREE_CODE (exp)((enum tree_code) (exp)->base.code))
2220 {
2221 case COND_EXPR:
2222 if (!is_bitfield_expr_with_lowered_type (TREE_OPERAND (exp, 1)(*((const_cast<tree*> (tree_operand_check ((exp), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2222, __FUNCTION__)))))
2223 ? TREE_OPERAND (exp, 1)(*((const_cast<tree*> (tree_operand_check ((exp), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2223, __FUNCTION__)))))
2224 : TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2224, __FUNCTION__)))))
))
2225 return NULL_TREE(tree) __null;
2226 return is_bitfield_expr_with_lowered_type (TREE_OPERAND (exp, 2)(*((const_cast<tree*> (tree_operand_check ((exp), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2226, __FUNCTION__)))))
);
2227
2228 case COMPOUND_EXPR:
2229 return is_bitfield_expr_with_lowered_type (TREE_OPERAND (exp, 1)(*((const_cast<tree*> (tree_operand_check ((exp), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2229, __FUNCTION__)))))
);
2230
2231 case MODIFY_EXPR:
2232 case SAVE_EXPR:
2233 return is_bitfield_expr_with_lowered_type (TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2233, __FUNCTION__)))))
);
2234
2235 case COMPONENT_REF:
2236 {
2237 tree field;
2238
2239 field = TREE_OPERAND (exp, 1)(*((const_cast<tree*> (tree_operand_check ((exp), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2239, __FUNCTION__)))))
;
2240 if (TREE_CODE (field)((enum tree_code) (field)->base.code) != FIELD_DECL || !DECL_BIT_FIELD_TYPE (field)((tree_check ((field), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2240, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_field_type
)
)
2241 return NULL_TREE(tree) __null;
2242 if (same_type_ignoring_top_level_qualifiers_p
2243 (TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2243, __FUNCTION__))->typed.type)
, DECL_BIT_FIELD_TYPE (field)((tree_check ((field), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2243, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_field_type
)
))
2244 return NULL_TREE(tree) __null;
2245 return DECL_BIT_FIELD_TYPE (field)((tree_check ((field), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2245, __FUNCTION__, (FIELD_DECL)))->field_decl.bit_field_type
)
;
2246 }
2247
2248 case VAR_DECL:
2249 if (DECL_HAS_VALUE_EXPR_P (exp)((tree_check3 ((exp), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2249, __FUNCTION__, (VAR_DECL), (PARM_DECL), (RESULT_DECL))
) ->decl_common.decl_flag_2)
)
2250 return is_bitfield_expr_with_lowered_type (DECL_VALUE_EXPR(decl_value_expr_lookup ((contains_struct_check (((const_cast
<union tree_node *> (((exp))))), (TS_DECL_WRTL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2251, __FUNCTION__))))
2251 (CONST_CAST_TREE (exp))(decl_value_expr_lookup ((contains_struct_check (((const_cast
<union tree_node *> (((exp))))), (TS_DECL_WRTL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2251, __FUNCTION__))))
);
2252 return NULL_TREE(tree) __null;
2253
2254 case VIEW_CONVERT_EXPR:
2255 if (location_wrapper_p (exp))
2256 return is_bitfield_expr_with_lowered_type (TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2256, __FUNCTION__)))))
);
2257 else
2258 return NULL_TREE(tree) __null;
2259
2260 default:
2261 return NULL_TREE(tree) __null;
2262 }
2263}
2264
2265/* Like is_bitfield_with_lowered_type, except that if EXP is not a
2266 bitfield with a lowered type, the type of EXP is returned, rather
2267 than NULL_TREE. */
2268
2269tree
2270unlowered_expr_type (const_tree exp)
2271{
2272 tree type;
2273 tree etype = TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2273, __FUNCTION__))->typed.type)
;
2274
2275 type = is_bitfield_expr_with_lowered_type (exp);
2276 if (type)
2277 type = cp_build_qualified_type (type, cp_type_quals (etype))cp_build_qualified_type_real ((type), (cp_type_quals (etype))
, tf_warning_or_error)
;
2278 else
2279 type = etype;
2280
2281 return type;
2282}
2283
2284/* Perform the conversions in [expr] that apply when an lvalue appears
2285 in an rvalue context: the lvalue-to-rvalue, array-to-pointer, and
2286 function-to-pointer conversions. In addition, bitfield references are
2287 converted to their declared types. Note that this function does not perform
2288 the lvalue-to-rvalue conversion for class types. If you need that conversion
2289 for class types, then you probably need to use force_rvalue.
2290
2291 Although the returned value is being used as an rvalue, this
2292 function does not wrap the returned expression in a
2293 NON_LVALUE_EXPR; the caller is expected to be mindful of the fact
2294 that the return value is no longer an lvalue. */
2295
2296tree
2297decay_conversion (tree exp,
2298 tsubst_flags_t complain,
2299 bool reject_builtin /* = true */)
2300{
2301 tree type;
2302 enum tree_code code;
2303 location_t loc = cp_expr_loc_or_input_loc (exp);
2304
2305 type = TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2305, __FUNCTION__))->typed.type)
;
2306 if (type == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2307 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2308
2309 exp = resolve_nondeduced_context_or_error (exp, complain);
2310
2311 code = TREE_CODE (type)((enum tree_code) (type)->base.code);
2312
2313 if (error_operand_p (exp))
2314 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2315
2316 if (NULLPTR_TYPE_P (type)(((enum tree_code) (type)->base.code) == NULLPTR_TYPE) && !TREE_SIDE_EFFECTS (exp)((non_type_check ((exp), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2316, __FUNCTION__))->base.side_effects_flag)
)
2317 {
2318 mark_rvalue_use (exp, loc, reject_builtin);
2319 return nullptr_nodecp_global_trees[CPTI_NULLPTR];
2320 }
2321
2322 /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
2323 Leave such NOP_EXPRs, since RHS is being used in non-lvalue context. */
2324 if (code == VOID_TYPE)
2325 {
2326 if (complain & tf_error)
2327 error_at (loc, "void value not ignored as it ought to be");
2328 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2329 }
2330 if (invalid_nonstatic_memfn_p (loc, exp, complain))
2331 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2332 if (code == FUNCTION_TYPE || is_overloaded_fn (exp))
2333 {
2334 exp = mark_lvalue_use (exp);
2335 if (reject_builtin && reject_gcc_builtin (exp, loc))
2336 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2337 return cp_build_addr_expr (exp, complain);
2338 }
2339 if (code == ARRAY_TYPE)
2340 {
2341 tree adr;
2342 tree ptrtype;
2343
2344 exp = mark_lvalue_use (exp);
2345
2346 if (INDIRECT_REF_P (exp)(((enum tree_code) (exp)->base.code) == INDIRECT_REF))
2347 return build_nop (build_pointer_type (TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2347, __FUNCTION__))->typed.type)
),
2348 TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2348, __FUNCTION__)))))
);
2349
2350 if (TREE_CODE (exp)((enum tree_code) (exp)->base.code) == COMPOUND_EXPR)
2351 {
2352 tree op1 = decay_conversion (TREE_OPERAND (exp, 1)(*((const_cast<tree*> (tree_operand_check ((exp), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2352, __FUNCTION__)))))
, complain);
2353 if (op1 == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2354 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2355 return build2 (COMPOUND_EXPR, TREE_TYPE (op1)((contains_struct_check ((op1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2355, __FUNCTION__))->typed.type)
,
2356 TREE_OPERAND (exp, 0)(*((const_cast<tree*> (tree_operand_check ((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2356, __FUNCTION__)))))
, op1);
2357 }
2358
2359 if (!obvalue_p (exp)
2360 && ! (TREE_CODE (exp)((enum tree_code) (exp)->base.code) == CONSTRUCTOR && TREE_STATIC (exp)((exp)->base.static_flag)))
2361 {
2362 if (complain & tf_error)
2363 error_at (loc, "invalid use of non-lvalue array");
2364 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2365 }
2366
2367 /* Don't let an array compound literal decay to a pointer. It can
2368 still be used to initialize an array or bind to a reference. */
2369 if (TREE_CODE (exp)((enum tree_code) (exp)->base.code) == TARGET_EXPR)
2370 {
2371 if (complain & tf_error)
2372 error_at (loc, "taking address of temporary array");
2373 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2374 }
2375
2376 ptrtype = build_pointer_type (TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2376, __FUNCTION__))->typed.type)
);
2377
2378 if (VAR_P (exp)(((enum tree_code) (exp)->base.code) == VAR_DECL))
2379 {
2380 if (!cxx_mark_addressable (exp))
2381 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2382 adr = build_nop (ptrtype, build_address (exp));
2383 return adr;
2384 }
2385 /* This way is better for a COMPONENT_REF since it can
2386 simplify the offset for a component. */
2387 adr = cp_build_addr_expr (exp, complain);
2388 return cp_convert (ptrtype, adr, complain);
2389 }
2390
2391 /* Otherwise, it's the lvalue-to-rvalue conversion. */
2392 exp = mark_rvalue_use (exp, loc, reject_builtin);
2393
2394 /* If a bitfield is used in a context where integral promotion
2395 applies, then the caller is expected to have used
2396 default_conversion. That function promotes bitfields correctly
2397 before calling this function. At this point, if we have a
2398 bitfield referenced, we may assume that is not subject to
2399 promotion, and that, therefore, the type of the resulting rvalue
2400 is the declared type of the bitfield. */
2401 exp = convert_bitfield_to_declared_type (exp);
2402
2403 /* We do not call rvalue() here because we do not want to wrap EXP
2404 in a NON_LVALUE_EXPR. */
2405
2406 /* [basic.lval]
2407
2408 Non-class rvalues always have cv-unqualified types. */
2409 type = TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2409, __FUNCTION__))->typed.type)
;
2410 if (!CLASS_TYPE_P (type)(((((enum tree_code) (type)->base.code)) == RECORD_TYPE ||
(((enum tree_code) (type)->base.code)) == UNION_TYPE) &&
((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2410, __FUNCTION__))->type_common.lang_flag_5))
&& cv_qualified_p (type))
2411 exp = build_nop (cv_unqualified (type), exp);
2412
2413 if (!complete_type_or_maybe_complain (type, exp, complain))
2414 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2415
2416 return exp;
2417}
2418
2419/* Perform preparatory conversions, as part of the "usual arithmetic
2420 conversions". In particular, as per [expr]:
2421
2422 Whenever an lvalue expression appears as an operand of an
2423 operator that expects the rvalue for that operand, the
2424 lvalue-to-rvalue, array-to-pointer, or function-to-pointer
2425 standard conversions are applied to convert the expression to an
2426 rvalue.
2427
2428 In addition, we perform integral promotions here, as those are
2429 applied to both operands to a binary operator before determining
2430 what additional conversions should apply. */
2431
2432static tree
2433cp_default_conversion (tree exp, tsubst_flags_t complain)
2434{
2435 /* Check for target-specific promotions. */
2436 tree promoted_type = targetm.promoted_type (TREE_TYPE (exp)((contains_struct_check ((exp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2436, __FUNCTION__))->typed.type)
);
2437 if (promoted_type)
2438 exp = cp_convert (promoted_type, exp, complain);
2439 /* Perform the integral promotions first so that bitfield
2440 expressions (which may promote to "int", even if the bitfield is
2441 declared "unsigned") are promoted correctly. */
2442 else if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (TREE_TYPE (exp))((((enum tree_code) (((contains_struct_check ((exp), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2442, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
&& !((tree_check ((((contains_struct_check ((exp), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2442, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2442, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (((contains_struct_check ((exp), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2442, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((exp), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2442, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
))
)
2443 exp = cp_perform_integral_promotions (exp, complain);
2444 /* Perform the other conversions. */
2445 exp = decay_conversion (exp, complain);
2446
2447 return exp;
2448}
2449
2450/* C version. */
2451
2452tree
2453default_conversion (tree exp)
2454{
2455 return cp_default_conversion (exp, tf_warning_or_error);
2456}
2457
2458/* EXPR is an expression with an integral or enumeration type.
2459 Perform the integral promotions in [conv.prom], and return the
2460 converted value. */
2461
2462tree
2463cp_perform_integral_promotions (tree expr, tsubst_flags_t complain)
2464{
2465 tree type;
2466 tree promoted_type;
2467
2468 expr = mark_rvalue_use (expr);
2469 if (error_operand_p (expr))
2470 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2471
2472 type = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2472, __FUNCTION__))->typed.type)
;
2473
2474 /* [conv.prom]
2475
2476 A prvalue for an integral bit-field (11.3.9) can be converted to a prvalue
2477 of type int if int can represent all the values of the bit-field;
2478 otherwise, it can be converted to unsigned int if unsigned int can
2479 represent all the values of the bit-field. If the bit-field is larger yet,
2480 no integral promotion applies to it. If the bit-field has an enumerated
2481 type, it is treated as any other value of that type for promotion
2482 purposes. */
2483 tree bitfield_type = is_bitfield_expr_with_lowered_type (expr);
2484 if (bitfield_type
2485 && (TREE_CODE (bitfield_type)((enum tree_code) (bitfield_type)->base.code) == ENUMERAL_TYPE
2486 || TYPE_PRECISION (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2486, __FUNCTION__))->type_common.precision)
> TYPE_PRECISION (integer_type_node)((tree_class_check ((integer_types[itk_int]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2486, __FUNCTION__))->type_common.precision)
))
2487 type = bitfield_type;
2488
2489 gcc_assert (INTEGRAL_OR_ENUMERATION_TYPE_P (type))((void)(!((((enum tree_code) (type)->base.code) == ENUMERAL_TYPE
|| (((enum tree_code) (type)->base.code) == BOOLEAN_TYPE ||
((enum tree_code) (type)->base.code) == INTEGER_TYPE))) ?
fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2489, __FUNCTION__), 0 : 0))
;
2490 /* Scoped enums don't promote. */
2491 if (SCOPED_ENUM_P (type)(((enum tree_code) (type)->base.code) == ENUMERAL_TYPE &&
((tree_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2491, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
)
)
2492 return expr;
2493 promoted_type = type_promotes_to (type);
2494 if (type != promoted_type)
2495 expr = cp_convert (promoted_type, expr, complain);
2496 else if (bitfield_type && bitfield_type != type)
2497 /* Prevent decay_conversion from converting to bitfield_type. */
2498 expr = build_nop (type, expr);
2499 return expr;
2500}
2501
2502/* C version. */
2503
2504tree
2505perform_integral_promotions (tree expr)
2506{
2507 return cp_perform_integral_promotions (expr, tf_warning_or_error);
2508}
2509
2510/* Returns nonzero iff exp is a STRING_CST or the result of applying
2511 decay_conversion to one. */
2512
2513int
2514string_conv_p (const_tree totype, const_tree exp, int warn)
2515{
2516 tree t;
2517
2518 if (!TYPE_PTR_P (totype)(((enum tree_code) (totype)->base.code) == POINTER_TYPE))
2519 return 0;
2520
2521 t = TREE_TYPE (totype)((contains_struct_check ((totype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2521, __FUNCTION__))->typed.type)
;
2522 if (!same_type_p (t, char_type_node)comptypes ((t), (integer_types[itk_char]), 0)
2523 && !same_type_p (t, char8_type_node)comptypes ((t), (c_global_trees[CTI_CHAR8_TYPE]), 0)
2524 && !same_type_p (t, char16_type_node)comptypes ((t), (c_global_trees[CTI_CHAR16_TYPE]), 0)
2525 && !same_type_p (t, char32_type_node)comptypes ((t), (c_global_trees[CTI_CHAR32_TYPE]), 0)
2526 && !same_type_p (t, wchar_type_node)comptypes ((t), (c_global_trees[CTI_WCHAR_TYPE]), 0))
2527 return 0;
2528
2529 location_t loc = EXPR_LOC_OR_LOC (exp, input_location)((((IS_ADHOC_LOC (((((exp)) && ((tree_code_type[(int)
(((enum tree_code) ((exp))->base.code))]) >= tcc_reference
&& (tree_code_type[(int) (((enum tree_code) ((exp))->
base.code))]) <= tcc_expression)) ? (exp)->exp.locus : (
(location_t) 0)))) ? get_location_from_adhoc_loc (line_table,
((((exp)) && ((tree_code_type[(int) (((enum tree_code
) ((exp))->base.code))]) >= tcc_reference && (tree_code_type
[(int) (((enum tree_code) ((exp))->base.code))]) <= tcc_expression
)) ? (exp)->exp.locus : ((location_t) 0))) : (((((exp)) &&
((tree_code_type[(int) (((enum tree_code) ((exp))->base.code
))]) >= tcc_reference && (tree_code_type[(int) (((
enum tree_code) ((exp))->base.code))]) <= tcc_expression
)) ? (exp)->exp.locus : ((location_t) 0)))) != ((location_t
) 0)) ? (exp)->exp.locus : (input_location))
;
2530
2531 STRIP_ANY_LOCATION_WRAPPER (exp)(exp) = tree_strip_any_location_wrapper ((const_cast<union
tree_node *> (((exp)))))
;
2532
2533 if (TREE_CODE (exp)((enum tree_code) (exp)->base.code) == STRING_CST)
2534 {
2535 /* Make sure that we don't try to convert between char and wide chars. */
2536 if (!same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (exp))), t)comptypes ((((tree_class_check ((((contains_struct_check ((((
contains_struct_check ((exp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2536, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2536, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2536, __FUNCTION__))->type_common.main_variant)), (t), 0
)
)
2537 return 0;
2538 }
2539 else
2540 {
2541 /* Is this a string constant which has decayed to 'const char *'? */
2542 t = build_pointer_type (cp_build_qualified_type (t, TYPE_QUAL_CONST)cp_build_qualified_type_real ((t), (TYPE_QUAL_CONST), tf_warning_or_error
)
);
2543 if (!same_type_p (TREE_TYPE (exp), t)comptypes ((((contains_struct_check ((exp), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2543, __FUNCTION__))->typed.type)), (t), 0)
)
2544 return 0;
2545 STRIP_NOPS (exp)(exp) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((exp)))))
;
2546 if (TREE_CODE (exp)((enum tree_code) (exp)->base.code) != ADDR_EXPR
2547 || TREE_CODE (TREE_OPERAND (exp, 0))((enum tree_code) ((*((const_cast<tree*> (tree_operand_check
((exp), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2547, __FUNCTION__))))))->base.code)
!= STRING_CST)
2548 return 0;
2549 }
2550 if (warn)
2551 {
2552 if (cxx_dialect >= cxx11)
2553 pedwarn (loc, OPT_Wwrite_strings,
2554 "ISO C++ forbids converting a string constant to %qT",
2555 totype);
2556 else
2557 warning_at (loc, OPT_Wwrite_strings,
2558 "deprecated conversion from string constant to %qT",
2559 totype);
2560 }
2561
2562 return 1;
2563}
2564
2565/* Given a COND_EXPR, MIN_EXPR, or MAX_EXPR in T, return it in a form that we
2566 can, for example, use as an lvalue. This code used to be in
2567 unary_complex_lvalue, but we needed it to deal with `a = (d == c) ? b : c'
2568 expressions, where we're dealing with aggregates. But now it's again only
2569 called from unary_complex_lvalue. The case (in particular) that led to
2570 this was with CODE == ADDR_EXPR, since it's not an lvalue when we'd
2571 get it there. */
2572
2573static tree
2574rationalize_conditional_expr (enum tree_code code, tree t,
2575 tsubst_flags_t complain)
2576{
2577 location_t loc = cp_expr_loc_or_input_loc (t);
2578
2579 /* For MIN_EXPR or MAX_EXPR, fold-const.c has arranged things so that
2580 the first operand is always the one to be used if both operands
2581 are equal, so we know what conditional expression this used to be. */
2582 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == MIN_EXPR || TREE_CODE (t)((enum tree_code) (t)->base.code) == MAX_EXPR)
2583 {
2584 tree op0 = TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2584, __FUNCTION__)))))
;
2585 tree op1 = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2585, __FUNCTION__)))))
;
2586
2587 /* The following code is incorrect if either operand side-effects. */
2588 gcc_assert (!TREE_SIDE_EFFECTS (op0)((void)(!(!((non_type_check ((op0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2588, __FUNCTION__))->base.side_effects_flag) &&
!((non_type_check ((op1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2589, __FUNCTION__))->base.side_effects_flag)) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2589, __FUNCTION__), 0 : 0))
2589 && !TREE_SIDE_EFFECTS (op1))((void)(!(!((non_type_check ((op0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2588, __FUNCTION__))->base.side_effects_flag) &&
!((non_type_check ((op1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2589, __FUNCTION__))->base.side_effects_flag)) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2589, __FUNCTION__), 0 : 0))
;
2590 return
2591 build_conditional_expr (loc,
2592 build_x_binary_op (loc,
2593 (TREE_CODE (t)((enum tree_code) (t)->base.code) == MIN_EXPR
2594 ? LE_EXPR : GE_EXPR),
2595 op0, TREE_CODE (op0)((enum tree_code) (op0)->base.code),
2596 op1, TREE_CODE (op1)((enum tree_code) (op1)->base.code),
2597 /*overload=*/NULL__null,
2598 complain),
2599 cp_build_unary_op (code, op0, false, complain),
2600 cp_build_unary_op (code, op1, false, complain),
2601 complain);
2602 }
2603
2604 tree op1 = TREE_OPERAND (t, 1)(*((const_cast<tree*> (tree_operand_check ((t), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2604, __FUNCTION__)))))
;
2605 if (TREE_CODE (op1)((enum tree_code) (op1)->base.code) != THROW_EXPR)
2606 op1 = cp_build_unary_op (code, op1, false, complain);
2607 tree op2 = TREE_OPERAND (t, 2)(*((const_cast<tree*> (tree_operand_check ((t), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2607, __FUNCTION__)))))
;
2608 if (TREE_CODE (op2)((enum tree_code) (op2)->base.code) != THROW_EXPR)
2609 op2 = cp_build_unary_op (code, op2, false, complain);
2610
2611 return
2612 build_conditional_expr (loc, TREE_OPERAND (t, 0)(*((const_cast<tree*> (tree_operand_check ((t), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2612, __FUNCTION__)))))
, op1, op2, complain);
2613}
2614
2615/* Given the TYPE of an anonymous union field inside T, return the
2616 FIELD_DECL for the field. If not found return NULL_TREE. Because
2617 anonymous unions can nest, we must also search all anonymous unions
2618 that are directly reachable. */
2619
2620tree
2621lookup_anon_field (tree, tree type)
2622{
2623 tree field;
2624
2625 type = TYPE_MAIN_VARIANT (type)((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2625, __FUNCTION__))->type_common.main_variant)
;
2626 field = ANON_AGGR_TYPE_FIELD (type)((((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2626, __FUNCTION__))->type_with_lang_specific.lang_specific
))->typeinfo_var)
;
2627 gcc_assert (field)((void)(!(field) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2627, __FUNCTION__), 0 : 0))
;
2628 return field;
2629}
2630
2631/* Build an expression representing OBJECT.MEMBER. OBJECT is an
2632 expression; MEMBER is a DECL or baselink. If ACCESS_PATH is
2633 non-NULL, it indicates the path to the base used to name MEMBER.
2634 If PRESERVE_REFERENCE is true, the expression returned will have
2635 REFERENCE_TYPE if the MEMBER does. Otherwise, the expression
2636 returned will have the type referred to by the reference.
2637
2638 This function does not perform access control; that is either done
2639 earlier by the parser when the name of MEMBER is resolved to MEMBER
2640 itself, or later when overload resolution selects one of the
2641 functions indicated by MEMBER. */
2642
2643tree
2644build_class_member_access_expr (cp_expr object, tree member,
2645 tree access_path, bool preserve_reference,
2646 tsubst_flags_t complain)
2647{
2648 tree object_type;
2649 tree member_scope;
2650 tree result = NULL_TREE(tree) __null;
2651 tree using_decl = NULL_TREE(tree) __null;
2652
2653 if (error_operand_p (object) || error_operand_p (member))
2654 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2655
2656 gcc_assert (DECL_P (member) || BASELINK_P (member))((void)(!((tree_code_type[(int) (((enum tree_code) (member)->
base.code))] == tcc_declaration) || (((enum tree_code) (member
)->base.code) == BASELINK)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2656, __FUNCTION__), 0 : 0))
;
2657
2658 /* [expr.ref]
2659
2660 The type of the first expression shall be "class object" (of a
2661 complete type). */
2662 object_type = TREE_TYPE (object)((contains_struct_check ((object), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2662, __FUNCTION__))->typed.type)
;
2663 if (!currently_open_class (object_type)
2664 && !complete_type_or_maybe_complain (object_type, object, complain))
2665 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2666 if (!CLASS_TYPE_P (object_type)(((((enum tree_code) (object_type)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (object_type)->base.code)) == UNION_TYPE
) && ((tree_class_check ((object_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2666, __FUNCTION__))->type_common.lang_flag_5))
)
2667 {
2668 if (complain & tf_error)
2669 {
2670 if (INDIRECT_TYPE_P (object_type)((((enum tree_code) (object_type)->base.code) == POINTER_TYPE
) || (((enum tree_code) (object_type)->base.code) == REFERENCE_TYPE
))
2671 && CLASS_TYPE_P (TREE_TYPE (object_type))(((((enum tree_code) (((contains_struct_check ((object_type),
(TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2671, __FUNCTION__))->typed.type))->base.code)) == RECORD_TYPE
|| (((enum tree_code) (((contains_struct_check ((object_type
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2671, __FUNCTION__))->typed.type))->base.code)) == UNION_TYPE
) && ((tree_class_check ((((contains_struct_check ((object_type
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2671, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2671, __FUNCTION__))->type_common.lang_flag_5))
)
2672 error ("request for member %qD in %qE, which is of pointer "
2673 "type %qT (maybe you meant to use %<->%> ?)",
2674 member, object.get_value (), object_type);
2675 else
2676 error ("request for member %qD in %qE, which is of non-class "
2677 "type %qT", member, object.get_value (), object_type);
2678 }
2679 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2680 }
2681
2682 /* The standard does not seem to actually say that MEMBER must be a
2683 member of OBJECT_TYPE. However, that is clearly what is
2684 intended. */
2685 if (DECL_P (member)(tree_code_type[(int) (((enum tree_code) (member)->base.code
))] == tcc_declaration)
)
2686 {
2687 member_scope = DECL_CLASS_CONTEXT (member)((((contains_struct_check ((member), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2687, __FUNCTION__))->decl_minimal.context) && (
tree_code_type[(int) (((enum tree_code) (((contains_struct_check
((member), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2687, __FUNCTION__))->decl_minimal.context))->base.code
))] == tcc_type)) ? ((contains_struct_check ((member), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2687, __FUNCTION__))->decl_minimal.context) : (tree) __null
)
;
2688 if (!mark_used (member, complain) && !(complain & tf_error))
2689 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2690
2691 if (TREE_UNAVAILABLE (member)((member)->base.u.bits.unavailable_flag))
2692 error_unavailable_use (member, NULL_TREE(tree) __null);
2693 else if (TREE_DEPRECATED (member)((member)->base.deprecated_flag))
2694 warn_deprecated_use (member, NULL_TREE(tree) __null);
2695 }
2696 else
2697 member_scope = BINFO_TYPE (BASELINK_ACCESS_BINFO (member))((contains_struct_check (((tree_check (((((struct tree_baselink
*) (tree_check ((member), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2697, __FUNCTION__, (BASELINK))))->access_binfo)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2697, __FUNCTION__, (TREE_BINFO)))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2697, __FUNCTION__))->typed.type)
;
2698 /* If MEMBER is from an anonymous aggregate, MEMBER_SCOPE will
2699 presently be the anonymous union. Go outwards until we find a
2700 type related to OBJECT_TYPE. */
2701 while ((ANON_AGGR_TYPE_P (member_scope)((((((enum tree_code) (member_scope)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (member_scope)->base.code)) == UNION_TYPE
) && ((tree_class_check ((member_scope), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2701, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((member_scope), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2701, __FUNCTION__))->type_with_lang_specific.lang_specific
))->anon_aggr)
|| UNSCOPED_ENUM_P (member_scope)(((enum tree_code) (member_scope)->base.code) == ENUMERAL_TYPE
&& !((tree_check ((member_scope), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2701, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
)
)
2702 && !same_type_ignoring_top_level_qualifiers_p (member_scope,
2703 object_type))
2704 member_scope = TYPE_CONTEXT (member_scope)((tree_class_check ((member_scope), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2704, __FUNCTION__))->type_common.context)
;
2705 if (!member_scope || !DERIVED_FROM_P (member_scope, object_type)(lookup_base ((object_type), (member_scope), ba_any, __null, tf_none
) != (tree) __null)
)
2706 {
2707 if (complain & tf_error)
2708 {
2709 if (TREE_CODE (member)((enum tree_code) (member)->base.code) == FIELD_DECL)
2710 error ("invalid use of non-static data member %qE", member);
2711 else
2712 error ("%qD is not a member of %qT", member, object_type);
2713 }
2714 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2715 }
2716
2717 /* Transform `(a, b).x' into `(*(a, &b)).x', `(a ? b : c).x' into
2718 `(*(a ? &b : &c)).x', and so on. A COND_EXPR is only an lvalue
2719 in the front end; only _DECLs and _REFs are lvalues in the back end. */
2720 {
2721 tree temp = unary_complex_lvalue (ADDR_EXPR, object);
2722 if (temp)
2723 {
2724 temp = cp_build_fold_indirect_ref (temp);
2725 if (xvalue_p (object) && !xvalue_p (temp))
2726 /* Preserve xvalue kind. */
2727 temp = move (temp);
2728 object = temp;
2729 }
2730 }
2731
2732 /* In [expr.ref], there is an explicit list of the valid choices for
2733 MEMBER. We check for each of those cases here. */
2734 if (VAR_P (member)(((enum tree_code) (member)->base.code) == VAR_DECL))
2735 {
2736 /* A static data member. */
2737 result = member;
2738 mark_exp_read (object);
2739
2740 if (tree wrap = maybe_get_tls_wrapper_call (result))
2741 /* Replace an evaluated use of the thread_local variable with
2742 a call to its wrapper. */
2743 result = wrap;
2744
2745 /* If OBJECT has side-effects, they are supposed to occur. */
2746 if (TREE_SIDE_EFFECTS (object)((non_type_check ((object), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2746, __FUNCTION__))->base.side_effects_flag)
)
2747 result = build2 (COMPOUND_EXPR, TREE_TYPE (result)((contains_struct_check ((result), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2747, __FUNCTION__))->typed.type)
, object, result);
2748 }
2749 else if (TREE_CODE (member)((enum tree_code) (member)->base.code) == FIELD_DECL)
2750 {
2751 /* A non-static data member. */
2752 bool null_object_p;
2753 int type_quals;
2754 tree member_type;
2755
2756 if (INDIRECT_REF_P (object)(((enum tree_code) (object)->base.code) == INDIRECT_REF))
2757 null_object_p =
2758 integer_zerop (tree_strip_nop_conversions (TREE_OPERAND (object, 0)(*((const_cast<tree*> (tree_operand_check ((object), (0
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2758, __FUNCTION__)))))
));
2759 else
2760 null_object_p = false;
2761
2762 /* Convert OBJECT to the type of MEMBER. */
2763 if (!same_type_p (TYPE_MAIN_VARIANT (object_type),comptypes ((((tree_class_check ((object_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2763, __FUNCTION__))->type_common.main_variant)), (((tree_class_check
((member_scope), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2764, __FUNCTION__))->type_common.main_variant)), 0)
2764 TYPE_MAIN_VARIANT (member_scope))comptypes ((((tree_class_check ((object_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2763, __FUNCTION__))->type_common.main_variant)), (((tree_class_check
((member_scope), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2764, __FUNCTION__))->type_common.main_variant)), 0)
)
2765 {
2766 tree binfo;
2767 base_kind kind;
2768
2769 /* We didn't complain above about a currently open class, but now we
2770 must: we don't know how to refer to a base member before layout is
2771 complete. But still don't complain in a template. */
2772 if (!cp_unevaluated_operand
2773 && !dependent_type_p (object_type)
2774 && !complete_type_or_maybe_complain (object_type, object,
2775 complain))
2776 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2777
2778 binfo = lookup_base (access_path ? access_path : object_type,
2779 member_scope, ba_unique, &kind, complain);
2780 if (binfo == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2781 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2782
2783 /* It is invalid to try to get to a virtual base of a
2784 NULL object. The most common cause is invalid use of
2785 offsetof macro. */
2786 if (null_object_p && kind == bk_via_virtual)
2787 {
2788 if (complain & tf_error)
2789 {
2790 error ("invalid access to non-static data member %qD in "
2791 "virtual base of NULL object", member);
2792 }
2793 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2794 }
2795
2796 /* Convert to the base. */
2797 object = build_base_path (PLUS_EXPR, object, binfo,
2798 /*nonnull=*/1, complain);
2799 /* If we found the base successfully then we should be able
2800 to convert to it successfully. */
2801 gcc_assert (object != error_mark_node)((void)(!(object != global_trees[TI_ERROR_MARK]) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2801, __FUNCTION__), 0 : 0))
;
2802 }
2803
2804 /* If MEMBER is from an anonymous aggregate, we have converted
2805 OBJECT so that it refers to the class containing the
2806 anonymous union. Generate a reference to the anonymous union
2807 itself, and recur to find MEMBER. */
2808 if (ANON_AGGR_TYPE_P (DECL_CONTEXT (member))((((((enum tree_code) (((contains_struct_check ((member), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2808, __FUNCTION__))->decl_minimal.context))->base.code
)) == RECORD_TYPE || (((enum tree_code) (((contains_struct_check
((member), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2808, __FUNCTION__))->decl_minimal.context))->base.code
)) == UNION_TYPE) && ((tree_class_check ((((contains_struct_check
((member), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2808, __FUNCTION__))->decl_minimal.context)), (tcc_type)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2808, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((((contains_struct_check ((member), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2808, __FUNCTION__))->decl_minimal.context)), (tcc_type)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2808, __FUNCTION__))->type_with_lang_specific.lang_specific
))->anon_aggr)
2809 /* When this code is called from build_field_call, the
2810 object already has the type of the anonymous union.
2811 That is because the COMPONENT_REF was already
2812 constructed, and was then disassembled before calling
2813 build_field_call. After the function-call code is
2814 cleaned up, this waste can be eliminated. */
2815 && (!same_type_ignoring_top_level_qualifiers_p
2816 (TREE_TYPE (object)((contains_struct_check ((object), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2816, __FUNCTION__))->typed.type)
, DECL_CONTEXT (member)((contains_struct_check ((member), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2816, __FUNCTION__))->decl_minimal.context)
)))
2817 {
2818 tree anonymous_union;
2819
2820 anonymous_union = lookup_anon_field (TREE_TYPE (object)((contains_struct_check ((object), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2820, __FUNCTION__))->typed.type)
,
2821 DECL_CONTEXT (member)((contains_struct_check ((member), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2821, __FUNCTION__))->decl_minimal.context)
);
2822 object = build_class_member_access_expr (object,
2823 anonymous_union,
2824 /*access_path=*/NULL_TREE(tree) __null,
2825 preserve_reference,
2826 complain);
2827 }
2828
2829 /* Compute the type of the field, as described in [expr.ref]. */
2830 type_quals = TYPE_UNQUALIFIED;
2831 member_type = TREE_TYPE (member)((contains_struct_check ((member), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2831, __FUNCTION__))->typed.type)
;
2832 if (!TYPE_REF_P (member_type)(((enum tree_code) (member_type)->base.code) == REFERENCE_TYPE
)
)
2833 {
2834 type_quals = (cp_type_quals (member_type)
2835 | cp_type_quals (object_type));
2836
2837 /* A field is const (volatile) if the enclosing object, or the
2838 field itself, is const (volatile). But, a mutable field is
2839 not const, even within a const object. */
2840 if (DECL_MUTABLE_P (member)(((contains_struct_check (((tree_check ((member), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2840, __FUNCTION__, (FIELD_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2840, __FUNCTION__))->decl_common.lang_flag_0))
)
2841 type_quals &= ~TYPE_QUAL_CONST;
2842 member_type = cp_build_qualified_type (member_type, type_quals)cp_build_qualified_type_real ((member_type), (type_quals), tf_warning_or_error
)
;
2843 }
2844
2845 result = build3_loc (input_location, COMPONENT_REF, member_type,
2846 object, member, NULL_TREE(tree) __null);
2847
2848 /* Mark the expression const or volatile, as appropriate. Even
2849 though we've dealt with the type above, we still have to mark the
2850 expression itself. */
2851 if (type_quals & TYPE_QUAL_CONST)
2852 TREE_READONLY (result)((non_type_check ((result), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2852, __FUNCTION__))->base.readonly_flag)
= 1;
2853 if (type_quals & TYPE_QUAL_VOLATILE)
2854 TREE_THIS_VOLATILE (result)((result)->base.volatile_flag) = 1;
2855 }
2856 else if (BASELINK_P (member)(((enum tree_code) (member)->base.code) == BASELINK))
2857 {
2858 /* The member is a (possibly overloaded) member function. */
2859 tree functions;
2860 tree type;
2861
2862 /* If the MEMBER is exactly one static member function, then we
2863 know the type of the expression. Otherwise, we must wait
2864 until overload resolution has been performed. */
2865 functions = BASELINK_FUNCTIONS (member)(((struct tree_baselink*) (tree_check ((member), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2865, __FUNCTION__, (BASELINK))))->functions)
;
2866 if (TREE_CODE (functions)((enum tree_code) (functions)->base.code) == FUNCTION_DECL
2867 && DECL_STATIC_FUNCTION_P (functions)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (functions)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((functions), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2867, __FUNCTION__, (TEMPLATE_DECL))))))))->result : functions
)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2867, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (functions)->base.code) == FUNCTION_DECL
|| (((enum tree_code) (functions)->base.code) == TEMPLATE_DECL
&& ((struct tree_template_decl *)(const_cast<union
tree_node *> ((((tree_check ((functions), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2867, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((functions
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2867, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2867, __FUNCTION__); &lt->u.fn; })->static_function
)
)
2868 type = TREE_TYPE (functions)((contains_struct_check ((functions), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2868, __FUNCTION__))->typed.type)
;
2869 else
2870 type = unknown_type_nodecp_global_trees[CPTI_UNKNOWN_TYPE];
2871 /* Note that we do not convert OBJECT to the BASELINK_BINFO
2872 base. That will happen when the function is called. */
2873 result = build3_loc (input_location, COMPONENT_REF, type, object, member,
2874 NULL_TREE(tree) __null);
2875 }
2876 else if (TREE_CODE (member)((enum tree_code) (member)->base.code) == CONST_DECL)
2877 {
2878 /* The member is an enumerator. */
2879 result = member;
2880 /* If OBJECT has side-effects, they are supposed to occur. */
2881 if (TREE_SIDE_EFFECTS (object)((non_type_check ((object), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2881, __FUNCTION__))->base.side_effects_flag)
)
2882 result = build2 (COMPOUND_EXPR, TREE_TYPE (result)((contains_struct_check ((result), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2882, __FUNCTION__))->typed.type)
,
2883 object, result);
2884 }
2885 else if ((using_decl = strip_using_decl (member)) != member)
2886 result = build_class_member_access_expr (object,
2887 using_decl,
2888 access_path, preserve_reference,
2889 complain);
2890 else
2891 {
2892 if (complain & tf_error)
2893 error ("invalid use of %qD", member);
2894 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2895 }
2896
2897 if (!preserve_reference)
2898 /* [expr.ref]
2899
2900 If E2 is declared to have type "reference to T", then ... the
2901 type of E1.E2 is T. */
2902 result = convert_from_reference (result);
2903
2904 return result;
2905}
2906
2907/* Return the destructor denoted by OBJECT.SCOPE::DTOR_NAME, or, if
2908 SCOPE is NULL, by OBJECT.DTOR_NAME, where DTOR_NAME is ~type. */
2909
2910tree
2911lookup_destructor (tree object, tree scope, tree dtor_name,
2912 tsubst_flags_t complain)
2913{
2914 tree object_type = TREE_TYPE (object)((contains_struct_check ((object), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2914, __FUNCTION__))->typed.type)
;
2915 tree dtor_type = TREE_OPERAND (dtor_name, 0)(*((const_cast<tree*> (tree_operand_check ((dtor_name),
(0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2915, __FUNCTION__)))))
;
2916 tree expr;
2917
2918 /* We've already complained about this destructor. */
2919 if (dtor_type == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2920 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2921
2922 if (scope && !check_dtor_name (scope, dtor_type))
2923 {
2924 if (complain & tf_error)
2925 error ("qualified type %qT does not match destructor name ~%qT",
2926 scope, dtor_type);
2927 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2928 }
2929 if (is_auto (dtor_type))
2930 dtor_type = object_type;
2931 else if (identifier_p (dtor_type))
2932 {
2933 /* In a template, names we can't find a match for are still accepted
2934 destructor names, and we check them here. */
2935 if (check_dtor_name (object_type, dtor_type))
2936 dtor_type = object_type;
2937 else
2938 {
2939 if (complain & tf_error)
2940 error ("object type %qT does not match destructor name ~%qT",
2941 object_type, dtor_type);
2942 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2943 }
2944
2945 }
2946 else if (!DERIVED_FROM_P (dtor_type, TYPE_MAIN_VARIANT (object_type))(lookup_base ((((tree_class_check ((object_type), (tcc_type),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2946, __FUNCTION__))->type_common.main_variant)), (dtor_type
), ba_any, __null, tf_none) != (tree) __null)
)
2947 {
2948 if (complain & tf_error)
2949 error ("the type being destroyed is %qT, but the destructor "
2950 "refers to %qT", TYPE_MAIN_VARIANT (object_type)((tree_class_check ((object_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2950, __FUNCTION__))->type_common.main_variant)
, dtor_type);
2951 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2952 }
2953 expr = lookup_member (dtor_type, complete_dtor_identifiercp_global_trees[CPTI_COMPLETE_DTOR_IDENTIFIER],
2954 /*protect=*/1, /*want_type=*/false,
2955 tf_warning_or_error);
2956 if (!expr)
2957 {
2958 if (complain & tf_error)
2959 cxx_incomplete_type_error (dtor_name, dtor_type);
2960 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
2961 }
2962 expr = (adjust_result_of_qualified_name_lookup
2963 (expr, dtor_type, object_type));
2964 if (scope == NULL_TREE(tree) __null)
2965 /* We need to call adjust_result_of_qualified_name_lookup in case the
2966 destructor names a base class, but we unset BASELINK_QUALIFIED_P so
2967 that we still get virtual function binding. */
2968 BASELINK_QUALIFIED_P (expr)((tree_not_check2 (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2968, __FUNCTION__, (BASELINK)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 2968, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)
= false;
2969 return expr;
2970}
2971
2972/* An expression of the form "A::template B" has been resolved to
2973 DECL. Issue a diagnostic if B is not a template or template
2974 specialization. */
2975
2976void
2977check_template_keyword (tree decl)
2978{
2979 /* The standard says:
2980
2981 [temp.names]
2982
2983 If a name prefixed by the keyword template is not a member
2984 template, the program is ill-formed.
2985
2986 DR 228 removed the restriction that the template be a member
2987 template.
2988
2989 DR 96, if accepted would add the further restriction that explicit
2990 template arguments must be provided if the template keyword is
2991 used, but, as of 2005-10-16, that DR is still in "drafting". If
2992 this DR is accepted, then the semantic checks here can be
2993 simplified, as the entity named must in fact be a template
2994 specialization, rather than, as at present, a set of overloaded
2995 functions containing at least one template function. */
2996 if (TREE_CODE (decl)((enum tree_code) (decl)->base.code) != TEMPLATE_DECL
2997 && TREE_CODE (decl)((enum tree_code) (decl)->base.code) != TEMPLATE_ID_EXPR)
2998 {
2999 if (VAR_P (decl)(((enum tree_code) (decl)->base.code) == VAR_DECL))
3000 {
3001 if (DECL_USE_TEMPLATE (decl)(((contains_struct_check ((decl), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3001, __FUNCTION__))->decl_common.lang_specific)->u.base
.use_template)
3002 && PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (decl))(((((contains_struct_check ((((tree_check ((((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((((struct
tree_template_info*)(tree_check (((((contains_struct_check (
(template_info_decl_check ((decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3002, __FUNCTION__)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3002, __FUNCTION__))->decl_common.lang_specific) ->u.
min.template_info)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3002, __FUNCTION__, (TEMPLATE_INFO))))->tmpl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3002, __FUNCTION__, (TEMPLATE_DECL))))))))->arguments), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3002, __FUNCTION__, (TREE_LIST)))->list.value)), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3002, __FUNCTION__))->typed.type))) == (((struct tree_template_info
*)(tree_check (((((contains_struct_check ((template_info_decl_check
((decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3002, __FUNCTION__)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3002, __FUNCTION__))->decl_common.lang_specific) ->u.
min.template_info)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3002, __FUNCTION__, (TEMPLATE_INFO))))->tmpl))
)
3003 ;
3004 else
3005 permerror (input_location, "%qD is not a template", decl);
3006 }
3007 else if (!is_overloaded_fn (decl))
3008 permerror (input_location, "%qD is not a template", decl);
3009 else
3010 {
3011 bool found = false;
3012
3013 for (lkp_iterator iter (MAYBE_BASELINK_FUNCTIONS (decl)((((enum tree_code) (decl)->base.code) == BASELINK) ? (((struct
tree_baselink*) (tree_check ((decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3013, __FUNCTION__, (BASELINK))))->functions) : decl)
);
3014 !found && iter; ++iter)
3015 {
3016 tree fn = *iter;
3017 if (TREE_CODE (fn)((enum tree_code) (fn)->base.code) == TEMPLATE_DECL
3018 || TREE_CODE (fn)((enum tree_code) (fn)->base.code) == TEMPLATE_ID_EXPR
3019 || (TREE_CODE (fn)((enum tree_code) (fn)->base.code) == FUNCTION_DECL
3020 && DECL_USE_TEMPLATE (fn)(((contains_struct_check ((fn), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3020, __FUNCTION__))->decl_common.lang_specific)->u.base
.use_template)
3021 && PRIMARY_TEMPLATE_P (DECL_TI_TEMPLATE (fn))(((((contains_struct_check ((((tree_check ((((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((((struct
tree_template_info*)(tree_check (((((contains_struct_check (
(template_info_decl_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3021, __FUNCTION__)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3021, __FUNCTION__))->decl_common.lang_specific) ->u.
min.template_info)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3021, __FUNCTION__, (TEMPLATE_INFO))))->tmpl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3021, __FUNCTION__, (TEMPLATE_DECL))))))))->arguments), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3021, __FUNCTION__, (TREE_LIST)))->list.value)), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3021, __FUNCTION__))->typed.type))) == (((struct tree_template_info
*)(tree_check (((((contains_struct_check ((template_info_decl_check
((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3021, __FUNCTION__)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3021, __FUNCTION__))->decl_common.lang_specific) ->u.
min.template_info)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3021, __FUNCTION__, (TEMPLATE_INFO))))->tmpl))
))
3022 found = true;
3023 }
3024 if (!found)
3025 permerror (input_location, "%qD is not a template", decl);
3026 }
3027 }
3028}
3029
3030/* Record that an access failure occurred on BASETYPE_PATH attempting
3031 to access DECL, where DIAG_DECL should be used for diagnostics. */
3032
3033void
3034access_failure_info::record_access_failure (tree basetype_path,
3035 tree decl, tree diag_decl)
3036{
3037 m_was_inaccessible = true;
3038 m_basetype_path = basetype_path;
3039 m_decl = decl;
3040 m_diag_decl = diag_decl;
3041}
3042
3043/* If an access failure was recorded, then attempt to locate an
3044 accessor function for the pertinent field.
3045 Otherwise, return NULL_TREE. */
3046
3047tree
3048access_failure_info::get_any_accessor (bool const_p) const
3049{
3050 if (!was_inaccessible_p ())
3051 return NULL_TREE(tree) __null;
3052
3053 tree accessor
3054 = locate_field_accessor (m_basetype_path, m_diag_decl, const_p);
3055 if (!accessor)
3056 return NULL_TREE(tree) __null;
3057
3058 /* The accessor must itself be accessible for it to be a reasonable
3059 suggestion. */
3060 if (!accessible_p (m_basetype_path, accessor, true))
3061 return NULL_TREE(tree) __null;
3062
3063 return accessor;
3064}
3065
3066/* Add a fix-it hint to RICHLOC suggesting the use of ACCESSOR_DECL, by
3067 replacing the primary location in RICHLOC with "accessor()". */
3068
3069void
3070access_failure_info::add_fixit_hint (rich_location *richloc,
3071 tree accessor_decl)
3072{
3073 pretty_printer pp;
3074 pp_string (&pp, IDENTIFIER_POINTER (DECL_NAME (accessor_decl))((const char *) (tree_check ((((contains_struct_check ((accessor_decl
), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3074, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3074, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str
)
);
3075 pp_string (&pp, "()");
3076 richloc->add_fixit_replace (pp_formatted_text (&pp));
3077}
3078
3079/* If an access failure was recorded, then attempt to locate an
3080 accessor function for the pertinent field, and if one is
3081 available, add a note and fix-it hint suggesting using it. */
3082
3083void
3084access_failure_info::maybe_suggest_accessor (bool const_p) const
3085{
3086 tree accessor = get_any_accessor (const_p);
3087 if (accessor == NULL_TREE(tree) __null)
3088 return;
3089 rich_location richloc (line_table, input_location);
3090 add_fixit_hint (&richloc, accessor);
3091 inform (&richloc, "field %q#D can be accessed via %q#D",
3092 m_diag_decl, accessor);
3093}
3094
3095/* Subroutine of finish_class_member_access_expr.
3096 Issue an error about NAME not being a member of ACCESS_PATH (or
3097 OBJECT_TYPE), potentially providing a fix-it hint for misspelled
3098 names. */
3099
3100static void
3101complain_about_unrecognized_member (tree access_path, tree name,
3102 tree object_type)
3103{
3104 /* Attempt to provide a hint about misspelled names. */
3105 tree guessed_id = lookup_member_fuzzy (access_path, name,
3106 /*want_type=*/false);
3107 if (guessed_id == NULL_TREE(tree) __null)
3108 {
3109 /* No hint. */
3110 error ("%q#T has no member named %qE",
3111 TREE_CODE (access_path)((enum tree_code) (access_path)->base.code) == TREE_BINFO
3112 ? TREE_TYPE (access_path)((contains_struct_check ((access_path), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3112, __FUNCTION__))->typed.type)
: object_type, name);
3113 return;
3114 }
3115
3116 location_t bogus_component_loc = input_location;
3117 gcc_rich_location rich_loc (bogus_component_loc);
3118
3119 /* Check that the guessed name is accessible along access_path. */
3120 access_failure_info afi;
3121 lookup_member (access_path, guessed_id, /*protect=*/1,
3122 /*want_type=*/false, /*complain=*/false,
3123 &afi);
3124 if (afi.was_inaccessible_p ())
3125 {
3126 tree accessor = afi.get_any_accessor (TYPE_READONLY (object_type)((tree_class_check ((object_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3126, __FUNCTION__))->base.readonly_flag)
);
3127 if (accessor)
3128 {
3129 /* The guessed name isn't directly accessible, but can be accessed
3130 via an accessor member function. */
3131 afi.add_fixit_hint (&rich_loc, accessor);
3132 error_at (&rich_loc,
3133 "%q#T has no member named %qE;"
3134 " did you mean %q#D? (accessible via %q#D)",
3135 TREE_CODE (access_path)((enum tree_code) (access_path)->base.code) == TREE_BINFO
3136 ? TREE_TYPE (access_path)((contains_struct_check ((access_path), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3136, __FUNCTION__))->typed.type)
: object_type,
3137 name, afi.get_diag_decl (), accessor);
3138 }
3139 else
3140 {
3141 /* The guessed name isn't directly accessible, and no accessor
3142 member function could be found. */
3143 error_at (&rich_loc,
3144 "%q#T has no member named %qE;"
3145 " did you mean %q#D? (not accessible from this context)",
3146 TREE_CODE (access_path)((enum tree_code) (access_path)->base.code) == TREE_BINFO
3147 ? TREE_TYPE (access_path)((contains_struct_check ((access_path), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3147, __FUNCTION__))->typed.type)
: object_type,
3148 name, afi.get_diag_decl ());
3149 complain_about_access (afi.get_decl (), afi.get_diag_decl (),
3150 afi.get_diag_decl (), false, ak_none);
3151 }
3152 }
3153 else
3154 {
3155 /* The guessed name is directly accessible; suggest it. */
3156 rich_loc.add_fixit_misspelled_id (bogus_component_loc,
3157 guessed_id);
3158 error_at (&rich_loc,
3159 "%q#T has no member named %qE;"
3160 " did you mean %qE?",
3161 TREE_CODE (access_path)((enum tree_code) (access_path)->base.code) == TREE_BINFO
3162 ? TREE_TYPE (access_path)((contains_struct_check ((access_path), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3162, __FUNCTION__))->typed.type)
: object_type,
3163 name, guessed_id);
3164 }
3165}
3166
3167/* This function is called by the parser to process a class member
3168 access expression of the form OBJECT.NAME. NAME is a node used by
3169 the parser to represent a name; it is not yet a DECL. It may,
3170 however, be a BASELINK where the BASELINK_FUNCTIONS is a
3171 TEMPLATE_ID_EXPR. Templates must be looked up by the parser, and
3172 there is no reason to do the lookup twice, so the parser keeps the
3173 BASELINK. TEMPLATE_P is true iff NAME was explicitly declared to
3174 be a template via the use of the "A::template B" syntax. */
3175
3176tree
3177finish_class_member_access_expr (cp_expr object, tree name, bool template_p,
3178 tsubst_flags_t complain)
3179{
3180 tree expr;
3181 tree object_type;
3182 tree member;
3183 tree access_path = NULL_TREE(tree) __null;
3184 tree orig_object = object;
3185 tree orig_name = name;
3186
3187 if (object == error_mark_nodeglobal_trees[TI_ERROR_MARK] || name == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3188 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3189
3190 /* If OBJECT is an ObjC class instance, we must obey ObjC access rules. */
3191 if (!objc_is_public (object, name))
3192 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3193
3194 object_type = TREE_TYPE (object)((contains_struct_check ((object), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3194, __FUNCTION__))->typed.type)
;
3195
3196 if (processing_template_declscope_chain->x_processing_template_decl)
3197 {
3198 if (/* If OBJECT is dependent, so is OBJECT.NAME. */
3199 type_dependent_object_expression_p (object)
3200 /* If NAME is "f<args>", where either 'f' or 'args' is
3201 dependent, then the expression is dependent. */
3202 || (TREE_CODE (name)((enum tree_code) (name)->base.code) == TEMPLATE_ID_EXPR
3203 && dependent_template_id_p (TREE_OPERAND (name, 0)(*((const_cast<tree*> (tree_operand_check ((name), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3203, __FUNCTION__)))))
,
3204 TREE_OPERAND (name, 1)(*((const_cast<tree*> (tree_operand_check ((name), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3204, __FUNCTION__)))))
))
3205 /* If NAME is "T::X" where "T" is dependent, then the
3206 expression is dependent. */
3207 || (TREE_CODE (name)((enum tree_code) (name)->base.code) == SCOPE_REF
3208 && TYPE_P (TREE_OPERAND (name, 0))(tree_code_type[(int) (((enum tree_code) ((*((const_cast<tree
*> (tree_operand_check ((name), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3208, __FUNCTION__))))))->base.code))] == tcc_type)
3209 && dependent_scope_p (TREE_OPERAND (name, 0)(*((const_cast<tree*> (tree_operand_check ((name), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3209, __FUNCTION__)))))
))
3210 /* If NAME is operator T where "T" is dependent, we can't
3211 lookup until we instantiate the T. */
3212 || (TREE_CODE (name)((enum tree_code) (name)->base.code) == IDENTIFIER_NODE
3213 && IDENTIFIER_CONV_OP_P (name)((((tree_not_check2 (((tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3213, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3213, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)) & ((tree_not_check2 (((tree_check ((name),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3213, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3213, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_1) & (!((tree_not_check2 (((tree_check ((name)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3213, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3213, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)))
3214 && dependent_type_p (TREE_TYPE (name)((contains_struct_check ((name), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3214, __FUNCTION__))->typed.type)
)))
3215 {
3216 dependent:
3217 return build_min_nt_loc (UNKNOWN_LOCATION((location_t) 0), COMPONENT_REF,
3218 orig_object, orig_name, NULL_TREE(tree) __null);
3219 }
3220 object = build_non_dependent_expr (object);
3221 }
3222 else if (c_dialect_objc ()((c_language & clk_objc) != 0)
3223 && identifier_p (name)
3224 && (expr = objc_maybe_build_component_ref (object, name)))
3225 return expr;
3226
3227 /* [expr.ref]
3228
3229 The type of the first expression shall be "class object" (of a
3230 complete type). */
3231 if (!currently_open_class (object_type)
3232 && !complete_type_or_maybe_complain (object_type, object, complain))
3233 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3234 if (!CLASS_TYPE_P (object_type)(((((enum tree_code) (object_type)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (object_type)->base.code)) == UNION_TYPE
) && ((tree_class_check ((object_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3234, __FUNCTION__))->type_common.lang_flag_5))
)
3235 {
3236 if (complain & tf_error)
3237 {
3238 if (INDIRECT_TYPE_P (object_type)((((enum tree_code) (object_type)->base.code) == POINTER_TYPE
) || (((enum tree_code) (object_type)->base.code) == REFERENCE_TYPE
))
3239 && CLASS_TYPE_P (TREE_TYPE (object_type))(((((enum tree_code) (((contains_struct_check ((object_type),
(TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3239, __FUNCTION__))->typed.type))->base.code)) == RECORD_TYPE
|| (((enum tree_code) (((contains_struct_check ((object_type
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3239, __FUNCTION__))->typed.type))->base.code)) == UNION_TYPE
) && ((tree_class_check ((((contains_struct_check ((object_type
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3239, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3239, __FUNCTION__))->type_common.lang_flag_5))
)
3240 error ("request for member %qD in %qE, which is of pointer "
3241 "type %qT (maybe you meant to use %<->%> ?)",
3242 name, object.get_value (), object_type);
3243 else
3244 error ("request for member %qD in %qE, which is of non-class "
3245 "type %qT", name, object.get_value (), object_type);
3246 }
3247 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3248 }
3249
3250 if (BASELINK_P (name)(((enum tree_code) (name)->base.code) == BASELINK))
3251 /* A member function that has already been looked up. */
3252 member = name;
3253 else
3254 {
3255 bool is_template_id = false;
3256 tree template_args = NULL_TREE(tree) __null;
3257 tree scope = NULL_TREE(tree) __null;
3258
3259 access_path = object_type;
3260
3261 if (TREE_CODE (name)((enum tree_code) (name)->base.code) == SCOPE_REF)
3262 {
3263 /* A qualified name. The qualifying class or namespace `S'
3264 has already been looked up; it is either a TYPE or a
3265 NAMESPACE_DECL. */
3266 scope = TREE_OPERAND (name, 0)(*((const_cast<tree*> (tree_operand_check ((name), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3266, __FUNCTION__)))))
;
3267 name = TREE_OPERAND (name, 1)(*((const_cast<tree*> (tree_operand_check ((name), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3267, __FUNCTION__)))))
;
3268
3269 /* If SCOPE is a namespace, then the qualified name does not
3270 name a member of OBJECT_TYPE. */
3271 if (TREE_CODE (scope)((enum tree_code) (scope)->base.code) == NAMESPACE_DECL)
3272 {
3273 if (complain & tf_error)
3274 error ("%<%D::%D%> is not a member of %qT",
3275 scope, name, object_type);
3276 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3277 }
3278 }
3279
3280 if (TREE_CODE (name)((enum tree_code) (name)->base.code) == TEMPLATE_ID_EXPR)
3281 {
3282 is_template_id = true;
3283 template_args = TREE_OPERAND (name, 1)(*((const_cast<tree*> (tree_operand_check ((name), (1),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3283, __FUNCTION__)))))
;
3284 name = TREE_OPERAND (name, 0)(*((const_cast<tree*> (tree_operand_check ((name), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3284, __FUNCTION__)))))
;
3285
3286 if (!identifier_p (name))
3287 name = OVL_NAME (name)((contains_struct_check ((ovl_first (name)), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3287, __FUNCTION__))->decl_minimal.name)
;
3288 }
3289
3290 if (scope)
3291 {
3292 if (TREE_CODE (scope)((enum tree_code) (scope)->base.code) == ENUMERAL_TYPE)
3293 {
3294 gcc_assert (!is_template_id)((void)(!(!is_template_id) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3294, __FUNCTION__), 0 : 0))
;
3295 /* Looking up a member enumerator (c++/56793). */
3296 if (!TYPE_CLASS_SCOPE_P (scope)(((tree_class_check ((scope), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3296, __FUNCTION__))->type_common.context) && (tree_code_type
[(int) (((enum tree_code) (((tree_class_check ((scope), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3296, __FUNCTION__))->type_common.context))->base.code
))] == tcc_type))
3297 || !DERIVED_FROM_P (TYPE_CONTEXT (scope), object_type)(lookup_base ((object_type), (((tree_class_check ((scope), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3297, __FUNCTION__))->type_common.context)), ba_any, __null
, tf_none) != (tree) __null)
)
3298 {
3299 if (complain & tf_error)
3300 error ("%<%D::%D%> is not a member of %qT",
3301 scope, name, object_type);
3302 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3303 }
3304 tree val = lookup_enumerator (scope, name);
3305 if (!val)
3306 {
3307 if (complain & tf_error)
3308 error ("%qD is not a member of %qD",
3309 name, scope);
3310 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3311 }
3312
3313 if (TREE_SIDE_EFFECTS (object)((non_type_check ((object), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3313, __FUNCTION__))->base.side_effects_flag)
)
3314 val = build2 (COMPOUND_EXPR, TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3314, __FUNCTION__))->typed.type)
, object, val);
3315 return val;
3316 }
3317
3318 gcc_assert (CLASS_TYPE_P (scope))((void)(!((((((enum tree_code) (scope)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (scope)->base.code)) == UNION_TYPE)
&& ((tree_class_check ((scope), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3318, __FUNCTION__))->type_common.lang_flag_5))) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3318, __FUNCTION__), 0 : 0))
;
3319 gcc_assert (identifier_p (name) || TREE_CODE (name) == BIT_NOT_EXPR)((void)(!(identifier_p (name) || ((enum tree_code) (name)->
base.code) == BIT_NOT_EXPR) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3319, __FUNCTION__), 0 : 0))
;
3320
3321 if (constructor_name_p (name, scope))
3322 {
3323 if (complain & tf_error)
3324 error ("cannot call constructor %<%T::%D%> directly",
3325 scope, name);
3326 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3327 }
3328
3329 /* Find the base of OBJECT_TYPE corresponding to SCOPE. */
3330 access_path = lookup_base (object_type, scope, ba_check,
3331 NULL__null, complain);
3332 if (access_path == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3333 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3334 if (!access_path)
3335 {
3336 if (any_dependent_bases_p (object_type))
3337 goto dependent;
3338 if (complain & tf_error)
3339 error ("%qT is not a base of %qT", scope, object_type);
3340 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3341 }
3342 }
3343
3344 if (TREE_CODE (name)((enum tree_code) (name)->base.code) == BIT_NOT_EXPR)
3345 {
3346 if (dependent_type_p (object_type))
3347 /* The destructor isn't declared yet. */
3348 goto dependent;
3349 member = lookup_destructor (object, scope, name, complain);
3350 }
3351 else
3352 {
3353 /* Look up the member. */
3354 access_failure_info afi;
3355 if (processing_template_declscope_chain->x_processing_template_decl)
3356 /* Even though this class member access expression is at this
3357 point not dependent, the member itself may be dependent, and
3358 we must not potentially push a access check for a dependent
3359 member onto TI_DEFERRED_ACCESS_CHECKS. So don't check access
3360 ahead of time here; we're going to redo this member lookup at
3361 instantiation time anyway. */
3362 push_deferring_access_checks (dk_no_check);
3363 member = lookup_member (access_path, name, /*protect=*/1,
3364 /*want_type=*/false, complain,
3365 &afi);
3366 if (processing_template_declscope_chain->x_processing_template_decl)
3367 pop_deferring_access_checks ();
3368 afi.maybe_suggest_accessor (TYPE_READONLY (object_type)((tree_class_check ((object_type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3368, __FUNCTION__))->base.readonly_flag)
);
3369 if (member == NULL_TREE(tree) __null)
3370 {
3371 if (dependent_type_p (object_type))
3372 /* Try again at instantiation time. */
3373 goto dependent;
3374 if (complain & tf_error)
3375 complain_about_unrecognized_member (access_path, name,
3376 object_type);
3377 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3378 }
3379 if (member == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3380 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3381 if (DECL_P (member)(tree_code_type[(int) (((enum tree_code) (member)->base.code
))] == tcc_declaration)
3382 && any_dependent_type_attributes_p (DECL_ATTRIBUTES (member)((contains_struct_check ((member), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3382, __FUNCTION__))->decl_common.attributes)
))
3383 /* Dependent type attributes on the decl mean that the TREE_TYPE is
3384 wrong, so don't use it. */
3385 goto dependent;
3386 if (TREE_CODE (member)((enum tree_code) (member)->base.code) == USING_DECL && DECL_DEPENDENT_P (member)((contains_struct_check (((tree_check ((member), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3386, __FUNCTION__, (USING_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3386, __FUNCTION__))->decl_common.lang_flag_0)
)
3387 goto dependent;
3388 }
3389
3390 if (is_template_id)
3391 {
3392 tree templ = member;
3393
3394 if (BASELINK_P (templ)(((enum tree_code) (templ)->base.code) == BASELINK))
3395 member = lookup_template_function (templ, template_args);
3396 else if (variable_template_p (templ))
3397 member = (lookup_and_finish_template_variable
3398 (templ, template_args, complain));
3399 else
3400 {
3401 if (complain & tf_error)
3402 error ("%qD is not a member template function", name);
3403 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3404 }
3405 }
3406 }
3407
3408 if (TREE_UNAVAILABLE (member)((member)->base.u.bits.unavailable_flag))
3409 error_unavailable_use (member, NULL_TREE(tree) __null);
3410 else if (TREE_DEPRECATED (member)((member)->base.deprecated_flag))
3411 warn_deprecated_use (member, NULL_TREE(tree) __null);
3412
3413 if (template_p)
3414 check_template_keyword (member);
3415
3416 expr = build_class_member_access_expr (object, member, access_path,
3417 /*preserve_reference=*/false,
3418 complain);
3419 if (processing_template_declscope_chain->x_processing_template_decl && expr != error_mark_nodeglobal_trees[TI_ERROR_MARK])
3420 {
3421 if (BASELINK_P (member)(((enum tree_code) (member)->base.code) == BASELINK))
3422 {
3423 if (TREE_CODE (orig_name)((enum tree_code) (orig_name)->base.code) == SCOPE_REF)
3424 BASELINK_QUALIFIED_P (member)((tree_not_check2 (((tree_check ((member), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3424, __FUNCTION__, (BASELINK)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3424, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)
= 1;
3425 orig_name = member;
3426 }
3427 return build_min_non_dep (COMPONENT_REF, expr,
3428 orig_object, orig_name,
3429 NULL_TREE(tree) __null);
3430 }
3431
3432 return expr;
3433}
3434
3435/* Build a COMPONENT_REF of OBJECT and MEMBER with the appropriate
3436 type. */
3437
3438tree
3439build_simple_component_ref (tree object, tree member)
3440{
3441 tree type = cp_build_qualified_type (TREE_TYPE (member),cp_build_qualified_type_real ((((contains_struct_check ((member
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3441, __FUNCTION__))->typed.type)), (cp_type_quals (((contains_struct_check
((object), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3442, __FUNCTION__))->typed.type))), tf_warning_or_error
)
3442 cp_type_quals (TREE_TYPE (object)))cp_build_qualified_type_real ((((contains_struct_check ((member
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3441, __FUNCTION__))->typed.type)), (cp_type_quals (((contains_struct_check
((object), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3442, __FUNCTION__))->typed.type))), tf_warning_or_error
)
;
3443 return build3_loc (input_location,
3444 COMPONENT_REF, type,
3445 object, member, NULL_TREE(tree) __null);
3446}
3447
3448/* Return an expression for the MEMBER_NAME field in the internal
3449 representation of PTRMEM, a pointer-to-member function. (Each
3450 pointer-to-member function type gets its own RECORD_TYPE so it is
3451 more convenient to access the fields by name than by FIELD_DECL.)
3452 This routine converts the NAME to a FIELD_DECL and then creates the
3453 node for the complete expression. */
3454
3455tree
3456build_ptrmemfunc_access_expr (tree ptrmem, tree member_name)
3457{
3458 tree ptrmem_type;
3459 tree member;
3460
3461 if (TREE_CODE (ptrmem)((enum tree_code) (ptrmem)->base.code) == CONSTRUCTOR)
3462 {
3463 for (auto &e: CONSTRUCTOR_ELTS (ptrmem)((tree_check ((ptrmem), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3463, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
)
3464 if (e.index && DECL_P (e.index)(tree_code_type[(int) (((enum tree_code) (e.index)->base.code
))] == tcc_declaration)
&& DECL_NAME (e.index)((contains_struct_check ((e.index), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3464, __FUNCTION__))->decl_minimal.name)
== member_name)
3465 return e.value;
3466 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3466, __FUNCTION__))
;
3467 }
3468
3469 /* This code is a stripped down version of
3470 build_class_member_access_expr. It does not work to use that
3471 routine directly because it expects the object to be of class
3472 type. */
3473 ptrmem_type = TREE_TYPE (ptrmem)((contains_struct_check ((ptrmem), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3473, __FUNCTION__))->typed.type)
;
3474 gcc_assert (TYPE_PTRMEMFUNC_P (ptrmem_type))((void)(!((((enum tree_code) (ptrmem_type)->base.code) == RECORD_TYPE
&& (((tree_class_check (((tree_check ((ptrmem_type),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3474, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3474, __FUNCTION__))->type_common.lang_flag_2)))) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3474, __FUNCTION__), 0 : 0))
;
3475 for (member = TYPE_FIELDS (ptrmem_type)((tree_check3 ((ptrmem_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3475, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
; member;
3476 member = DECL_CHAIN (member)(((contains_struct_check (((contains_struct_check ((member), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3476, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3476, __FUNCTION__))->common.chain))
)
3477 if (DECL_NAME (member)((contains_struct_check ((member), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3477, __FUNCTION__))->decl_minimal.name)
== member_name)
3478 break;
3479 return build_simple_component_ref (ptrmem, member);
3480}
3481
3482/* Given an expression PTR for a pointer, return an expression
3483 for the value pointed to.
3484 ERRORSTRING is the name of the operator to appear in error messages.
3485
3486 This function may need to overload OPERATOR_FNNAME.
3487 Must also handle REFERENCE_TYPEs for C++. */
3488
3489tree
3490build_x_indirect_ref (location_t loc, tree expr, ref_operator errorstring,
3491 tsubst_flags_t complain)
3492{
3493 tree orig_expr = expr;
3494 tree rval;
3495 tree overload = NULL_TREE(tree) __null;
3496
3497 if (processing_template_declscope_chain->x_processing_template_decl)
3498 {
3499 /* Retain the type if we know the operand is a pointer. */
3500 if (TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3500, __FUNCTION__))->typed.type)
&& INDIRECT_TYPE_P (TREE_TYPE (expr))((((enum tree_code) (((contains_struct_check ((expr), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3500, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
) || (((enum tree_code) (((contains_struct_check ((expr), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3500, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
))
)
3501 {
3502 if (expr == current_class_ptr(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ptr : &scope_chain
->x_current_class_ptr))
3503 || (TREE_CODE (expr)((enum tree_code) (expr)->base.code) == NOP_EXPR
3504 && TREE_OPERAND (expr, 0)(*((const_cast<tree*> (tree_operand_check ((expr), (0),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3504, __FUNCTION__)))))
== current_class_ptr(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ptr : &scope_chain
->x_current_class_ptr))
3505 && (same_type_ignoring_top_level_qualifiers_p
3506 (TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3506, __FUNCTION__))->typed.type)
, TREE_TYPE (current_class_ptr)((contains_struct_check (((*((cfun + 0) && ((cfun + 0
)->language) ? &((cfun + 0)->language)->x_current_class_ptr
: &scope_chain->x_current_class_ptr))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3506, __FUNCTION__))->typed.type)
))))
3507 return current_class_ref(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ref : &scope_chain
->x_current_class_ref))
;
3508 return build_min (INDIRECT_REF, TREE_TYPE (TREE_TYPE (expr))((contains_struct_check ((((contains_struct_check ((expr), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3508, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3508, __FUNCTION__))->typed.type)
, expr);
3509 }
3510 if (type_dependent_expression_p (expr))
3511 return build_min_nt_loc (loc, INDIRECT_REF, expr);
3512 expr = build_non_dependent_expr (expr);
3513 }
3514
3515 rval = build_new_op (loc, INDIRECT_REF, LOOKUP_NORMAL((1 << 0)), expr,
3516 NULL_TREE(tree) __null, NULL_TREE(tree) __null, &overload, complain);
3517 if (!rval)
3518 rval = cp_build_indirect_ref (loc, expr, errorstring, complain);
3519
3520 if (processing_template_declscope_chain->x_processing_template_decl && rval != error_mark_nodeglobal_trees[TI_ERROR_MARK])
3521 {
3522 if (overload != NULL_TREE(tree) __null)
3523 return (build_min_non_dep_op_overload
3524 (INDIRECT_REF, rval, overload, orig_expr));
3525
3526 return build_min_non_dep (INDIRECT_REF, rval, orig_expr);
3527 }
3528 else
3529 return rval;
3530}
3531
3532/* Like c-family strict_aliasing_warning, but don't warn for dependent
3533 types or expressions. */
3534
3535static bool
3536cp_strict_aliasing_warning (location_t loc, tree type, tree expr)
3537{
3538 if (processing_template_declscope_chain->x_processing_template_decl)
3539 {
3540 tree e = expr;
3541 STRIP_NOPS (e)(e) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((e)))))
;
3542 if (dependent_type_p (type) || type_dependent_expression_p (e))
3543 return false;
3544 }
3545 return strict_aliasing_warning (loc, type, expr);
3546}
3547
3548/* The implementation of the above, and of indirection implied by other
3549 constructs. If DO_FOLD is true, fold away INDIRECT_REF of ADDR_EXPR. */
3550
3551static tree
3552cp_build_indirect_ref_1 (location_t loc, tree ptr, ref_operator errorstring,
3553 tsubst_flags_t complain, bool do_fold)
3554{
3555 tree pointer, type;
3556
3557 /* RO_NULL should only be used with the folding entry points below, not
3558 cp_build_indirect_ref. */
3559 gcc_checking_assert (errorstring != RO_NULL || do_fold)((void)(!(errorstring != RO_NULL || do_fold) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3559, __FUNCTION__), 0 : 0))
;
3560
3561 if (ptr == current_class_ptr(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ptr : &scope_chain
->x_current_class_ptr))
3562 || (TREE_CODE (ptr)((enum tree_code) (ptr)->base.code) == NOP_EXPR
3563 && TREE_OPERAND (ptr, 0)(*((const_cast<tree*> (tree_operand_check ((ptr), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3563, __FUNCTION__)))))
== current_class_ptr(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ptr : &scope_chain
->x_current_class_ptr))
3564 && (same_type_ignoring_top_level_qualifiers_p
3565 (TREE_TYPE (ptr)((contains_struct_check ((ptr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3565, __FUNCTION__))->typed.type)
, TREE_TYPE (current_class_ptr)((contains_struct_check (((*((cfun + 0) && ((cfun + 0
)->language) ? &((cfun + 0)->language)->x_current_class_ptr
: &scope_chain->x_current_class_ptr))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3565, __FUNCTION__))->typed.type)
))))
3566 return current_class_ref(*((cfun + 0) && ((cfun + 0)->language) ? &((cfun
+ 0)->language)->x_current_class_ref : &scope_chain
->x_current_class_ref))
;
3567
3568 pointer = (TYPE_REF_P (TREE_TYPE (ptr))(((enum tree_code) (((contains_struct_check ((ptr), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3568, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
)
3569 ? ptr : decay_conversion (ptr, complain));
3570 if (pointer == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3571 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3572
3573 type = TREE_TYPE (pointer)((contains_struct_check ((pointer), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3573, __FUNCTION__))->typed.type)
;
3574
3575 if (INDIRECT_TYPE_P (type)((((enum tree_code) (type)->base.code) == POINTER_TYPE) ||
(((enum tree_code) (type)->base.code) == REFERENCE_TYPE))
)
3576 {
3577 /* [expr.unary.op]
3578
3579 If the type of the expression is "pointer to T," the type
3580 of the result is "T." */
3581 tree t = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3581, __FUNCTION__))->typed.type)
;
3582
3583 if ((CONVERT_EXPR_P (ptr)((((enum tree_code) (ptr)->base.code)) == NOP_EXPR || (((enum
tree_code) (ptr)->base.code)) == CONVERT_EXPR)
3584 || TREE_CODE (ptr)((enum tree_code) (ptr)->base.code) == VIEW_CONVERT_EXPR)
3585 && (!CLASS_TYPE_P (t)(((((enum tree_code) (t)->base.code)) == RECORD_TYPE || ((
(enum tree_code) (t)->base.code)) == UNION_TYPE) &&
((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3585, __FUNCTION__))->type_common.lang_flag_5))
|| !CLASSTYPE_EMPTY_P (t)((((tree_class_check ((t), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3585, __FUNCTION__))->type_with_lang_specific.lang_specific
))->empty_p)
))
3586 {
3587 /* If a warning is issued, mark it to avoid duplicates from
3588 the backend. This only needs to be done at
3589 warn_strict_aliasing > 2. */
3590 if (warn_strict_aliasingglobal_options.x_warn_strict_aliasing > 2
3591 && cp_strict_aliasing_warning (EXPR_LOCATION (ptr)((((ptr)) && ((tree_code_type[(int) (((enum tree_code
) ((ptr))->base.code))]) >= tcc_reference && (tree_code_type
[(int) (((enum tree_code) ((ptr))->base.code))]) <= tcc_expression
)) ? (ptr)->exp.locus : ((location_t) 0))
,
3592 type, TREE_OPERAND (ptr, 0)(*((const_cast<tree*> (tree_operand_check ((ptr), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3592, __FUNCTION__)))))
))
3593 suppress_warning (ptr, OPT_Wstrict_aliasing);
3594 }
3595
3596 if (VOID_TYPE_P (t)(((enum tree_code) (t)->base.code) == VOID_TYPE))
3597 {
3598 /* A pointer to incomplete type (other than cv void) can be
3599 dereferenced [expr.unary.op]/1 */
3600 if (complain & tf_error)
3601 error_at (loc, "%qT is not a pointer-to-object type", type);
3602 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3603 }
3604 else if (do_fold && TREE_CODE (pointer)((enum tree_code) (pointer)->base.code) == ADDR_EXPR
3605 && same_type_p (t, TREE_TYPE (TREE_OPERAND (pointer, 0)))comptypes ((t), (((contains_struct_check (((*((const_cast<
tree*> (tree_operand_check ((pointer), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3605, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3605, __FUNCTION__))->typed.type)), 0)
)
3606 /* The POINTER was something like `&x'. We simplify `*&x' to
3607 `x'. */
3608 return TREE_OPERAND (pointer, 0)(*((const_cast<tree*> (tree_operand_check ((pointer), (
0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3608, __FUNCTION__)))))
;
3609 else
3610 {
3611 tree ref = build1 (INDIRECT_REF, t, pointer);
3612
3613 /* We *must* set TREE_READONLY when dereferencing a pointer to const,
3614 so that we get the proper error message if the result is used
3615 to assign to. Also, &* is supposed to be a no-op. */
3616 TREE_READONLY (ref)((non_type_check ((ref), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3616, __FUNCTION__))->base.readonly_flag)
= CP_TYPE_CONST_P (t)((cp_type_quals (t) & TYPE_QUAL_CONST) != 0);
3617 TREE_THIS_VOLATILE (ref)((ref)->base.volatile_flag) = CP_TYPE_VOLATILE_P (t)((cp_type_quals (t) & TYPE_QUAL_VOLATILE) != 0);
3618 TREE_SIDE_EFFECTS (ref)((non_type_check ((ref), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3618, __FUNCTION__))->base.side_effects_flag)
3619 = (TREE_THIS_VOLATILE (ref)((ref)->base.volatile_flag) || TREE_SIDE_EFFECTS (pointer)((non_type_check ((pointer), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3619, __FUNCTION__))->base.side_effects_flag)
);
3620 return ref;
3621 }
3622 }
3623 else if (!(complain & tf_error))
3624 /* Don't emit any errors; we'll just return ERROR_MARK_NODE later. */
3625 ;
3626 /* `pointer' won't be an error_mark_node if we were given a
3627 pointer to member, so it's cool to check for this here. */
3628 else if (TYPE_PTRMEM_P (type)((((enum tree_code) (type)->base.code) == OFFSET_TYPE) || (
((enum tree_code) (type)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3628, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3628, __FUNCTION__))->type_common.lang_flag_2))))
)
3629 switch (errorstring)
3630 {
3631 case RO_ARRAY_INDEXING:
3632 error_at (loc,
3633 "invalid use of array indexing on pointer to member");
3634 break;
3635 case RO_UNARY_STAR:
3636 error_at (loc, "invalid use of unary %<*%> on pointer to member");
3637 break;
3638 case RO_IMPLICIT_CONVERSION:
3639 error_at (loc, "invalid use of implicit conversion on pointer "
3640 "to member");
3641 break;
3642 case RO_ARROW_STAR:
3643 error_at (loc, "left hand operand of %<->*%> must be a pointer to "
3644 "class, but is a pointer to member of type %qT", type);
3645 break;
3646 default:
3647 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3647, __FUNCTION__))
;
3648 }
3649 else if (pointer != error_mark_nodeglobal_trees[TI_ERROR_MARK])
3650 invalid_indirection_error (loc, type, errorstring);
3651
3652 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3653}
3654
3655/* Entry point used by c-common, which expects folding. */
3656
3657tree
3658build_indirect_ref (location_t loc, tree ptr, ref_operator errorstring)
3659{
3660 return cp_build_indirect_ref_1 (loc, ptr, errorstring,
3661 tf_warning_or_error, true);
3662}
3663
3664/* Entry point used by internal indirection needs that don't correspond to any
3665 syntactic construct. */
3666
3667tree
3668cp_build_fold_indirect_ref (tree pointer)
3669{
3670 return cp_build_indirect_ref_1 (input_location, pointer, RO_NULL,
3671 tf_warning_or_error, true);
3672}
3673
3674/* Entry point used by indirection needs that correspond to some syntactic
3675 construct. */
3676
3677tree
3678cp_build_indirect_ref (location_t loc, tree ptr, ref_operator errorstring,
3679 tsubst_flags_t complain)
3680{
3681 return cp_build_indirect_ref_1 (loc, ptr, errorstring, complain, false);
3682}
3683
3684/* This handles expressions of the form "a[i]", which denotes
3685 an array reference.
3686
3687 This is logically equivalent in C to *(a+i), but we may do it differently.
3688 If A is a variable or a member, we generate a primitive ARRAY_REF.
3689 This avoids forcing the array out of registers, and can work on
3690 arrays that are not lvalues (for example, members of structures returned
3691 by functions).
3692
3693 If INDEX is of some user-defined type, it must be converted to
3694 integer type. Otherwise, to make a compatible PLUS_EXPR, it
3695 will inherit the type of the array, which will be some pointer type.
3696
3697 LOC is the location to use in building the array reference. */
3698
3699tree
3700cp_build_array_ref (location_t loc, tree array, tree idx,
3701 tsubst_flags_t complain)
3702{
3703 tree ret;
3704
3705 if (idx == 0)
3706 {
3707 if (complain & tf_error)
3708 error_at (loc, "subscript missing in array reference");
3709 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3710 }
3711
3712 if (TREE_TYPE (array)((contains_struct_check ((array), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3712, __FUNCTION__))->typed.type)
== error_mark_nodeglobal_trees[TI_ERROR_MARK]
3713 || TREE_TYPE (idx)((contains_struct_check ((idx), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3713, __FUNCTION__))->typed.type)
== error_mark_nodeglobal_trees[TI_ERROR_MARK])
3714 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3715
3716 /* If ARRAY is a COMPOUND_EXPR or COND_EXPR, move our reference
3717 inside it. */
3718 switch (TREE_CODE (array)((enum tree_code) (array)->base.code))
3719 {
3720 case COMPOUND_EXPR:
3721 {
3722 tree value = cp_build_array_ref (loc, TREE_OPERAND (array, 1)(*((const_cast<tree*> (tree_operand_check ((array), (1)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3722, __FUNCTION__)))))
, idx,
3723 complain);
3724 ret = build2 (COMPOUND_EXPR, TREE_TYPE (value)((contains_struct_check ((value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3724, __FUNCTION__))->typed.type)
,
3725 TREE_OPERAND (array, 0)(*((const_cast<tree*> (tree_operand_check ((array), (0)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3725, __FUNCTION__)))))
, value);
3726 SET_EXPR_LOCATION (ret, loc)(expr_check (((ret)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3726, __FUNCTION__))->exp.locus = (loc)
;
3727 return ret;
3728 }
3729
3730 case COND_EXPR:
3731 ret = build_conditional_expr
3732 (loc, TREE_OPERAND (array, 0)(*((const_cast<tree*> (tree_operand_check ((array), (0)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3732, __FUNCTION__)))))
,
3733 cp_build_array_ref (loc, TREE_OPERAND (array, 1)(*((const_cast<tree*> (tree_operand_check ((array), (1)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3733, __FUNCTION__)))))
, idx,
3734 complain),
3735 cp_build_array_ref (loc, TREE_OPERAND (array, 2)(*((const_cast<tree*> (tree_operand_check ((array), (2)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3735, __FUNCTION__)))))
, idx,
3736 complain),
3737 complain);
3738 protected_set_expr_location (ret, loc);
3739 return ret;
3740
3741 default:
3742 break;
3743 }
3744
3745 bool non_lvalue = convert_vector_to_array_for_subscript (loc, &array, idx);
3746
3747 if (TREE_CODE (TREE_TYPE (array))((enum tree_code) (((contains_struct_check ((array), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3747, __FUNCTION__))->typed.type))->base.code)
== ARRAY_TYPE)
3748 {
3749 tree rval, type;
3750
3751 warn_array_subscript_with_type_char (loc, idx);
3752
3753 if (!INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (TREE_TYPE (idx))((((enum tree_code) (((contains_struct_check ((idx), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3753, __FUNCTION__))->typed.type))->base.code) == ENUMERAL_TYPE
&& !((tree_check ((((contains_struct_check ((idx), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3753, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3753, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (((contains_struct_check ((idx), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3753, __FUNCTION__))->typed.type))->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (((contains_struct_check ((idx), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3753, __FUNCTION__))->typed.type))->base.code) == INTEGER_TYPE
))
)
3754 {
3755 if (complain & tf_error)
3756 error_at (loc, "array subscript is not an integer");
3757 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3758 }
3759
3760 /* Apply integral promotions *after* noticing character types.
3761 (It is unclear why we do these promotions -- the standard
3762 does not say that we should. In fact, the natural thing would
3763 seem to be to convert IDX to ptrdiff_t; we're performing
3764 pointer arithmetic.) */
3765 idx = cp_perform_integral_promotions (idx, complain);
3766
3767 idx = maybe_fold_non_dependent_expr (idx, complain);
3768
3769 /* An array that is indexed by a non-constant
3770 cannot be stored in a register; we must be able to do
3771 address arithmetic on its address.
3772 Likewise an array of elements of variable size. */
3773 if (TREE_CODE (idx)((enum tree_code) (idx)->base.code) != INTEGER_CST
3774 || (COMPLETE_TYPE_P (TREE_TYPE (TREE_TYPE (array)))(((tree_class_check ((((contains_struct_check ((((contains_struct_check
((array), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3774, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3774, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3774, __FUNCTION__))->type_common.size) != (tree) __null
)
3775 && (TREE_CODE (TYPE_SIZE (TREE_TYPE (TREE_TYPE (array))))((enum tree_code) (((tree_class_check ((((contains_struct_check
((((contains_struct_check ((array), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3775, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3775, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3775, __FUNCTION__))->type_common.size))->base.code)
3776 != INTEGER_CST)))
3777 {
3778 if (!cxx_mark_addressable (array, true))
3779 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3780 }
3781
3782 /* An array that is indexed by a constant value which is not within
3783 the array bounds cannot be stored in a register either; because we
3784 would get a crash in store_bit_field/extract_bit_field when trying
3785 to access a non-existent part of the register. */
3786 if (TREE_CODE (idx)((enum tree_code) (idx)->base.code) == INTEGER_CST
3787 && TYPE_DOMAIN (TREE_TYPE (array))((tree_check ((((contains_struct_check ((array), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3787, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3787, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
3788 && ! int_fits_type_p (idx, TYPE_DOMAIN (TREE_TYPE (array))((tree_check ((((contains_struct_check ((array), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3788, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3788, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
))
3789 {
3790 if (!cxx_mark_addressable (array))
3791 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3792 }
3793
3794 /* Note in C++ it is valid to subscript a `register' array, since
3795 it is valid to take the address of something with that
3796 storage specification. */
3797 if (extra_warningsglobal_options.x_extra_warnings)
3798 {
3799 tree foo = array;
3800 while (TREE_CODE (foo)((enum tree_code) (foo)->base.code) == COMPONENT_REF)
3801 foo = TREE_OPERAND (foo, 0)(*((const_cast<tree*> (tree_operand_check ((foo), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3801, __FUNCTION__)))))
;
3802 if (VAR_P (foo)(((enum tree_code) (foo)->base.code) == VAR_DECL) && DECL_REGISTER (foo)((contains_struct_check ((foo), (TS_DECL_WRTL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3802, __FUNCTION__))->decl_common.decl_flag_0)
3803 && (complain & tf_warning))
3804 warning_at (loc, OPT_Wextra,
3805 "subscripting array declared %<register%>");
3806 }
3807
3808 type = TREE_TYPE (TREE_TYPE (array))((contains_struct_check ((((contains_struct_check ((array), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3808, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3808, __FUNCTION__))->typed.type)
;
3809 rval = build4 (ARRAY_REF, type, array, idx, NULL_TREE(tree) __null, NULL_TREE(tree) __null);
3810 /* Array ref is const/volatile if the array elements are
3811 or if the array is.. */
3812 TREE_READONLY (rval)((non_type_check ((rval), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3812, __FUNCTION__))->base.readonly_flag)
3813 |= (CP_TYPE_CONST_P (type)((cp_type_quals (type) & TYPE_QUAL_CONST) != 0) | TREE_READONLY (array)((non_type_check ((array), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3813, __FUNCTION__))->base.readonly_flag)
);
3814 TREE_SIDE_EFFECTS (rval)((non_type_check ((rval), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3814, __FUNCTION__))->base.side_effects_flag)
3815 |= (CP_TYPE_VOLATILE_P (type)((cp_type_quals (type) & TYPE_QUAL_VOLATILE) != 0) | TREE_SIDE_EFFECTS (array)((non_type_check ((array), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3815, __FUNCTION__))->base.side_effects_flag)
);
3816 TREE_THIS_VOLATILE (rval)((rval)->base.volatile_flag)
3817 |= (CP_TYPE_VOLATILE_P (type)((cp_type_quals (type) & TYPE_QUAL_VOLATILE) != 0) | TREE_THIS_VOLATILE (array)((array)->base.volatile_flag));
3818 ret = require_complete_type_sfinae (rval, complain);
3819 protected_set_expr_location (ret, loc);
3820 if (non_lvalue)
3821 ret = non_lvalue_loc (loc, ret);
3822 return ret;
3823 }
3824
3825 {
3826 tree ar = cp_default_conversion (array, complain);
3827 tree ind = cp_default_conversion (idx, complain);
3828 tree first = NULL_TREE(tree) __null;
3829
3830 if (flag_strong_eval_orderglobal_options.x_flag_strong_eval_order == 2 && TREE_SIDE_EFFECTS (ind)((non_type_check ((ind), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3830, __FUNCTION__))->base.side_effects_flag)
)
3831 ar = first = save_expr (ar);
3832
3833 /* Put the integer in IND to simplify error checking. */
3834 if (TREE_CODE (TREE_TYPE (ar))((enum tree_code) (((contains_struct_check ((ar), (TS_TYPED),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3834, __FUNCTION__))->typed.type))->base.code)
== INTEGER_TYPE)
3835 std::swap (ar, ind);
3836
3837 if (ar == error_mark_nodeglobal_trees[TI_ERROR_MARK] || ind == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3838 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3839
3840 if (!TYPE_PTR_P (TREE_TYPE (ar))(((enum tree_code) (((contains_struct_check ((ar), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3840, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
)
)
3841 {
3842 if (complain & tf_error)
3843 error_at (loc, "subscripted value is neither array nor pointer");
3844 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3845 }
3846 if (TREE_CODE (TREE_TYPE (ind))((enum tree_code) (((contains_struct_check ((ind), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3846, __FUNCTION__))->typed.type))->base.code)
!= INTEGER_TYPE)
3847 {
3848 if (complain & tf_error)
3849 error_at (loc, "array subscript is not an integer");
3850 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3851 }
3852
3853 warn_array_subscript_with_type_char (loc, idx);
3854
3855 ret = cp_build_binary_op (input_location, PLUS_EXPR, ar, ind, complain);
3856 if (first)
3857 ret = build2_loc (loc, COMPOUND_EXPR, TREE_TYPE (ret)((contains_struct_check ((ret), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3857, __FUNCTION__))->typed.type)
, first, ret);
3858 ret = cp_build_indirect_ref (loc, ret, RO_ARRAY_INDEXING, complain);
3859 protected_set_expr_location (ret, loc);
3860 if (non_lvalue)
3861 ret = non_lvalue_loc (loc, ret);
3862 return ret;
3863 }
3864}
3865
3866/* Entry point for Obj-C++. */
3867
3868tree
3869build_array_ref (location_t loc, tree array, tree idx)
3870{
3871 return cp_build_array_ref (loc, array, idx, tf_warning_or_error);
3872}
3873
3874/* Resolve a pointer to member function. INSTANCE is the object
3875 instance to use, if the member points to a virtual member.
3876
3877 This used to avoid checking for virtual functions if basetype
3878 has no virtual functions, according to an earlier ANSI draft.
3879 With the final ISO C++ rules, such an optimization is
3880 incorrect: A pointer to a derived member can be static_cast
3881 to pointer-to-base-member, as long as the dynamic object
3882 later has the right member. So now we only do this optimization
3883 when we know the dynamic type of the object. */
3884
3885tree
3886get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function,
3887 tsubst_flags_t complain)
3888{
3889 if (TREE_CODE (function)((enum tree_code) (function)->base.code) == OFFSET_REF)
3890 function = TREE_OPERAND (function, 1)(*((const_cast<tree*> (tree_operand_check ((function), (
1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3890, __FUNCTION__)))))
;
3891
3892 if (TYPE_PTRMEMFUNC_P (TREE_TYPE (function))(((enum tree_code) (((contains_struct_check ((function), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3892, __FUNCTION__))->typed.type))->base.code) == RECORD_TYPE
&& (((tree_class_check (((tree_check ((((contains_struct_check
((function), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3892, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3892, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3892, __FUNCTION__))->type_common.lang_flag_2)))
)
3893 {
3894 tree idx, delta, e1, e2, e3, vtbl;
3895 bool nonvirtual;
3896 tree fntype = TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (function))(cp_build_qualified_type_real ((((contains_struct_check ((((tree_check3
((((contains_struct_check ((function), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3896, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3896, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3896, __FUNCTION__))->typed.type)), (cp_type_quals (((contains_struct_check
((function), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3896, __FUNCTION__))->typed.type))), tf_warning_or_error
))
;
3897 tree basetype = TYPE_METHOD_BASETYPE (TREE_TYPE (fntype))((tree_check2 ((((contains_struct_check ((fntype), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3897, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3897, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval)
;
3898
3899 tree instance_ptr = *instance_ptrptr;
3900 tree instance_save_expr = 0;
3901 if (instance_ptr == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3902 {
3903 if (TREE_CODE (function)((enum tree_code) (function)->base.code) == PTRMEM_CST)
3904 {
3905 /* Extracting the function address from a pmf is only
3906 allowed with -Wno-pmf-conversions. It only works for
3907 pmf constants. */
3908 e1 = build_addr_func (PTRMEM_CST_MEMBER (function)(((ptrmem_cst_t)(tree_check ((function), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3908, __FUNCTION__, (PTRMEM_CST))))->member)
, complain);
3909 e1 = convert (fntype, e1);
3910 return e1;
3911 }
3912 else
3913 {
3914 if (complain & tf_error)
3915 error ("object missing in use of %qE", function);
3916 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3917 }
3918 }
3919
3920 /* True if we know that the dynamic type of the object doesn't have
3921 virtual functions, so we can assume the PFN field is a pointer. */
3922 nonvirtual = (COMPLETE_TYPE_P (basetype)(((tree_class_check ((basetype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3922, __FUNCTION__))->type_common.size) != (tree) __null
)
3923 && !TYPE_POLYMORPHIC_P (basetype)(((tree_not_check2 ((basetype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3923, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2))
3924 && resolves_to_fixed_type_p (instance_ptr, 0));
3925
3926 /* If we don't really have an object (i.e. in an ill-formed
3927 conversion from PMF to pointer), we can't resolve virtual
3928 functions anyway. */
3929 if (!nonvirtual && is_dummy_object (instance_ptr))
3930 nonvirtual = true;
3931
3932 if (TREE_SIDE_EFFECTS (instance_ptr)((non_type_check ((instance_ptr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3932, __FUNCTION__))->base.side_effects_flag)
)
3933 instance_ptr = instance_save_expr = save_expr (instance_ptr);
3934
3935 if (TREE_SIDE_EFFECTS (function)((non_type_check ((function), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3935, __FUNCTION__))->base.side_effects_flag)
)
3936 function = save_expr (function);
3937
3938 /* Start by extracting all the information from the PMF itself. */
3939 e3 = pfn_from_ptrmemfunc (function);
3940 delta = delta_from_ptrmemfunc (function);
3941 idx = build1 (NOP_EXPR, vtable_index_typecp_global_trees[CPTI_VTABLE_INDEX_TYPE], e3);
3942 switch (TARGET_PTRMEMFUNC_VBIT_LOCATIONptrmemfunc_vbit_in_pfn)
3943 {
3944 int flag_sanitize_save;
3945 case ptrmemfunc_vbit_in_pfn:
3946 e1 = cp_build_binary_op (input_location,
3947 BIT_AND_EXPR, idx, integer_one_nodeglobal_trees[TI_INTEGER_ONE],
3948 complain);
3949 idx = cp_build_binary_op (input_location,
3950 MINUS_EXPR, idx, integer_one_nodeglobal_trees[TI_INTEGER_ONE],
3951 complain);
3952 if (idx == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3953 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3954 break;
3955
3956 case ptrmemfunc_vbit_in_delta:
3957 e1 = cp_build_binary_op (input_location,
3958 BIT_AND_EXPR, delta, integer_one_nodeglobal_trees[TI_INTEGER_ONE],
3959 complain);
3960 /* Don't instrument the RSHIFT_EXPR we're about to create because
3961 we're going to use DELTA number of times, and that wouldn't play
3962 well with SAVE_EXPRs therein. */
3963 flag_sanitize_save = flag_sanitizeglobal_options.x_flag_sanitize;
3964 flag_sanitizeglobal_options.x_flag_sanitize = 0;
3965 delta = cp_build_binary_op (input_location,
3966 RSHIFT_EXPR, delta, integer_one_nodeglobal_trees[TI_INTEGER_ONE],
3967 complain);
3968 flag_sanitizeglobal_options.x_flag_sanitize = flag_sanitize_save;
3969 if (delta == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3970 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3971 break;
3972
3973 default:
3974 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3974, __FUNCTION__))
;
3975 }
3976
3977 if (e1 == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3978 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3979
3980 /* Convert down to the right base before using the instance. A
3981 special case is that in a pointer to member of class C, C may
3982 be incomplete. In that case, the function will of course be
3983 a member of C, and no conversion is required. In fact,
3984 lookup_base will fail in that case, because incomplete
3985 classes do not have BINFOs. */
3986 if (!same_type_ignoring_top_level_qualifiers_p
3987 (basetype, TREE_TYPE (TREE_TYPE (instance_ptr))((contains_struct_check ((((contains_struct_check ((instance_ptr
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3987, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3987, __FUNCTION__))->typed.type)
))
3988 {
3989 basetype = lookup_base (TREE_TYPE (TREE_TYPE (instance_ptr))((contains_struct_check ((((contains_struct_check ((instance_ptr
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3989, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 3989, __FUNCTION__))->typed.type)
,
3990 basetype, ba_check, NULL__null, complain);
3991 instance_ptr = build_base_path (PLUS_EXPR, instance_ptr, basetype,
3992 1, complain);
3993 if (instance_ptr == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3994 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
3995 }
3996 /* ...and then the delta in the PMF. */
3997 instance_ptr = fold_build_pointer_plus (instance_ptr, delta)fold_build_pointer_plus_loc (((location_t) 0), instance_ptr, delta
)
;
3998
3999 /* Hand back the adjusted 'this' argument to our caller. */
4000 *instance_ptrptr = instance_ptr;
4001
4002 if (nonvirtual)
4003 /* Now just return the pointer. */
4004 return e3;
4005
4006 /* Next extract the vtable pointer from the object. */
4007 vtbl = build1 (NOP_EXPR, build_pointer_type (vtbl_ptr_type_nodecp_global_trees[CPTI_VTBL_PTR_TYPE]),
4008 instance_ptr);
4009 vtbl = cp_build_fold_indirect_ref (vtbl);
4010 if (vtbl == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4011 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4012
4013 /* Finally, extract the function pointer from the vtable. */
4014 e2 = fold_build_pointer_plus_loc (input_location, vtbl, idx);
4015 e2 = cp_build_fold_indirect_ref (e2);
4016 if (e2 == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4017 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4018 TREE_CONSTANT (e2)((non_type_check ((e2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4018, __FUNCTION__))->base.constant_flag)
= 1;
4019
4020 /* When using function descriptors, the address of the
4021 vtable entry is treated as a function pointer. */
4022 if (TARGET_VTABLE_USES_DESCRIPTORS0)
4023 e2 = build1 (NOP_EXPR, TREE_TYPE (e2)((contains_struct_check ((e2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4023, __FUNCTION__))->typed.type)
,
4024 cp_build_addr_expr (e2, complain));
4025
4026 e2 = fold_convert (TREE_TYPE (e3), e2)fold_convert_loc (((location_t) 0), ((contains_struct_check (
(e3), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4026, __FUNCTION__))->typed.type), e2)
;
4027 e1 = build_conditional_expr (input_location, e1, e2, e3, complain);
4028 if (e1 == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4029 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4030
4031 /* Make sure this doesn't get evaluated first inside one of the
4032 branches of the COND_EXPR. */
4033 if (instance_save_expr)
4034 e1 = build2 (COMPOUND_EXPR, TREE_TYPE (e1)((contains_struct_check ((e1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4034, __FUNCTION__))->typed.type)
,
4035 instance_save_expr, e1);
4036
4037 function = e1;
4038 }
4039 return function;
4040}
4041
4042/* Used by the C-common bits. */
4043tree
4044build_function_call (location_t /*loc*/,
4045 tree function, tree params)
4046{
4047 return cp_build_function_call (function, params, tf_warning_or_error);
4048}
4049
4050/* Used by the C-common bits. */
4051tree
4052build_function_call_vec (location_t /*loc*/, vec<location_t> /*arg_loc*/,
4053 tree function, vec<tree, va_gc> *params,
4054 vec<tree, va_gc> * /*origtypes*/, tree orig_function)
4055{
4056 vec<tree, va_gc> *orig_params = params;
4057 tree ret = cp_build_function_call_vec (function, &params,
4058 tf_warning_or_error, orig_function);
4059
4060 /* cp_build_function_call_vec can reallocate PARAMS by adding
4061 default arguments. That should never happen here. Verify
4062 that. */
4063 gcc_assert (params == orig_params)((void)(!(params == orig_params) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4063, __FUNCTION__), 0 : 0))
;
4064
4065 return ret;
4066}
4067
4068/* Build a function call using a tree list of arguments. */
4069
4070static tree
4071cp_build_function_call (tree function, tree params, tsubst_flags_t complain)
4072{
4073 tree ret;
4074
4075 releasing_vec vec;
4076 for (; params != NULL_TREE(tree) __null; params = TREE_CHAIN (params)((contains_struct_check ((params), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4076, __FUNCTION__))->common.chain)
)
4077 vec_safe_push (vec, TREE_VALUE (params)((tree_check ((params), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4077, __FUNCTION__, (TREE_LIST)))->list.value)
);
4078 ret = cp_build_function_call_vec (function, &vec, complain);
4079 return ret;
4080}
4081
4082/* Build a function call using varargs. */
4083
4084tree
4085cp_build_function_call_nary (tree function, tsubst_flags_t complain, ...)
4086{
4087 va_list args;
4088 tree ret, t;
4089
4090 releasing_vec vec;
4091 va_start (args, complain)__builtin_va_start(args, complain);
4092 for (t = va_arg (args, tree)__builtin_va_arg(args, tree); t != NULL_TREE(tree) __null; t = va_arg (args, tree)__builtin_va_arg(args, tree))
1
Assuming 't' is not equal to NULL_TREE
2
Loop condition is true. Entering loop body
4093 vec_safe_push (vec, t);
3
Calling 'vec_safe_push'
4094 va_end (args)__builtin_va_end(args);
4095 ret = cp_build_function_call_vec (function, &vec, complain);
4096 return ret;
4097}
4098
4099/* Build a function call using a vector of arguments.
4100 If FUNCTION is the result of resolving an overloaded target built-in,
4101 ORIG_FNDECL is the original function decl, otherwise it is null.
4102 PARAMS may be NULL if there are no parameters. This changes the
4103 contents of PARAMS. */
4104
4105tree
4106cp_build_function_call_vec (tree function, vec<tree, va_gc> **params,
4107 tsubst_flags_t complain, tree orig_fndecl)
4108{
4109 tree fntype, fndecl;
4110 int is_method;
4111 tree original = function;
4112 int nargs;
4113 tree *argarray;
4114 tree parm_types;
4115 vec<tree, va_gc> *allocated = NULL__null;
4116 tree ret;
4117
4118 /* For Objective-C, convert any calls via a cast to OBJC_TYPE_REF
4119 expressions, like those used for ObjC messenger dispatches. */
4120 if (params != NULL__null && !vec_safe_is_empty (*params))
4121 function = objc_rewrite_function_call (function, (**params)[0]);
4122
4123 /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
4124 Strip such NOP_EXPRs, since FUNCTION is used in non-lvalue context. */
4125 if (TREE_CODE (function)((enum tree_code) (function)->base.code) == NOP_EXPR
4126 && TREE_TYPE (function)((contains_struct_check ((function), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4126, __FUNCTION__))->typed.type)
== TREE_TYPE (TREE_OPERAND (function, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((function), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4126, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4126, __FUNCTION__))->typed.type)
)
4127 function = TREE_OPERAND (function, 0)(*((const_cast<tree*> (tree_operand_check ((function), (
0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4127, __FUNCTION__)))))
;
4128
4129 if (TREE_CODE (function)((enum tree_code) (function)->base.code) == FUNCTION_DECL)
4130 {
4131 if (!mark_used (function, complain))
4132 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4133 fndecl = function;
4134
4135 /* Convert anything with function type to a pointer-to-function. */
4136 if (DECL_MAIN_P (function)(((((enum tree_code) (function)->base.code) == FUNCTION_DECL
&& !(((enum tree_code) (function)->base.code) == FUNCTION_DECL
&& ((contains_struct_check ((function), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4136, __FUNCTION__))->decl_common.lang_specific) &&
__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (function)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((function), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4136, __FUNCTION__, (TEMPLATE_DECL))))))))->result : function
)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4136, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (function)->base.code) == FUNCTION_DECL ||
(((enum tree_code) (function)->base.code) == TEMPLATE_DECL
&& ((struct tree_template_decl *)(const_cast<union
tree_node *> ((((tree_check ((function), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4136, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((function
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4136, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) || lt->u.base.selector != lds_fn
) lang_check_failed ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4136, __FUNCTION__); &lt->u.fn; })->thunk_p)) &&
((((contains_struct_check ((function), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4136, __FUNCTION__))->decl_common.lang_specific) ? ((contains_struct_check
((function), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4136, __FUNCTION__))->decl_common.lang_specific)->u.base
.language : (((enum tree_code) (function)->base.code) == FUNCTION_DECL
? lang_c : lang_cplusplus)) == lang_c)) && ((contains_struct_check
((function), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4136, __FUNCTION__))->decl_minimal.name) != (tree) __null
&& ((tree_check ((((contains_struct_check ((function
), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4136, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4136, __FUNCTION__, (IDENTIFIER_NODE))) == global_trees[TI_MAIN_IDENTIFIER
]) && flag_hosted)
)
4137 {
4138 if (complain & tf_error)
4139 pedwarn (input_location, OPT_Wpedantic,
4140 "ISO C++ forbids calling %<::main%> from within program");
4141 else
4142 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4143 }
4144 function = build_addr_func (function, complain);
4145 }
4146 else
4147 {
4148 fndecl = NULL_TREE(tree) __null;
4149
4150 function = build_addr_func (function, complain);
4151 }
4152
4153 if (function == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4154 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4155
4156 fntype = TREE_TYPE (function)((contains_struct_check ((function), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4156, __FUNCTION__))->typed.type)
;
4157
4158 if (TYPE_PTRMEMFUNC_P (fntype)(((enum tree_code) (fntype)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((fntype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4158, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4158, __FUNCTION__))->type_common.lang_flag_2)))
)
4159 {
4160 if (complain & tf_error)
4161 error ("must use %<.*%> or %<->*%> to call pointer-to-member "
4162 "function in %<%E (...)%>, e.g. %<(... ->* %E) (...)%>",
4163 original, original);
4164 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4165 }
4166
4167 is_method = (TYPE_PTR_P (fntype)(((enum tree_code) (fntype)->base.code) == POINTER_TYPE)
4168 && TREE_CODE (TREE_TYPE (fntype))((enum tree_code) (((contains_struct_check ((fntype), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4168, __FUNCTION__))->typed.type))->base.code)
== METHOD_TYPE);
4169
4170 if (!(TYPE_PTRFN_P (fntype)((((enum tree_code) (fntype)->base.code) == POINTER_TYPE) &&
((enum tree_code) (((contains_struct_check ((fntype), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4170, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
)
4171 || is_method
4172 || TREE_CODE (function)((enum tree_code) (function)->base.code) == TEMPLATE_ID_EXPR))
4173 {
4174 if (complain & tf_error)
4175 {
4176 if (!flag_diagnostics_show_caretglobal_options.x_flag_diagnostics_show_caret)
4177 error_at (input_location,
4178 "%qE cannot be used as a function", original);
4179 else if (DECL_P (original)(tree_code_type[(int) (((enum tree_code) (original)->base.
code))] == tcc_declaration)
)
4180 error_at (input_location,
4181 "%qD cannot be used as a function", original);
4182 else
4183 error_at (input_location,
4184 "expression cannot be used as a function");
4185 }
4186
4187 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4188 }
4189
4190 /* fntype now gets the type of function pointed to. */
4191 fntype = TREE_TYPE (fntype)((contains_struct_check ((fntype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4191, __FUNCTION__))->typed.type)
;
4192 parm_types = TYPE_ARG_TYPES (fntype)((tree_check2 ((fntype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4192, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)
;
4193
4194 if (params == NULL__null)
4195 {
4196 allocated = make_tree_vector ();
4197 params = &allocated;
4198 }
4199
4200 nargs = convert_arguments (parm_types, params, fndecl, LOOKUP_NORMAL((1 << 0)),
4201 complain);
4202 if (nargs < 0)
4203 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4204
4205 argarray = (*params)->address ();
4206
4207 /* Check for errors in format strings and inappropriately
4208 null parameters. */
4209 bool warned_p = check_function_arguments (input_location, fndecl, fntype,
4210 nargs, argarray, NULL__null);
4211
4212 ret = build_cxx_call (function, nargs, argarray, complain, orig_fndecl);
4213
4214 if (warned_p)
4215 {
4216 tree c = extract_call_expr (ret);
4217 if (TREE_CODE (c)((enum tree_code) (c)->base.code) == CALL_EXPR)
4218 suppress_warning (c, OPT_Wnonnull);
4219 }
4220
4221 if (allocated != NULL__null)
4222 release_tree_vector (allocated);
4223
4224 return ret;
4225}
4226
4227/* Subroutine of convert_arguments.
4228 Print an error message about a wrong number of arguments. */
4229
4230static void
4231error_args_num (location_t loc, tree fndecl, bool too_many_p)
4232{
4233 if (fndecl)
4234 {
4235 if (TREE_CODE (TREE_TYPE (fndecl))((enum tree_code) (((contains_struct_check ((fndecl), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4235, __FUNCTION__))->typed.type))->base.code)
== METHOD_TYPE)
4236 {
4237 if (DECL_NAME (fndecl)((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4237, __FUNCTION__))->decl_minimal.name)
== NULL_TREE(tree) __null
4238 || (DECL_NAME (fndecl)((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4238, __FUNCTION__))->decl_minimal.name)
4239 == DECL_NAME (TYPE_NAME (DECL_CONTEXT (fndecl)))((contains_struct_check ((((tree_class_check ((((contains_struct_check
((fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4239, __FUNCTION__))->decl_minimal.context)), (tcc_type)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4239, __FUNCTION__))->type_common.name)), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4239, __FUNCTION__))->decl_minimal.name)
))
4240 error_at (loc,
4241 too_many_p
4242 ? G_("too many arguments to constructor %q#D")"too many arguments to constructor %q#D"
4243 : G_("too few arguments to constructor %q#D")"too few arguments to constructor %q#D",
4244 fndecl);
4245 else
4246 error_at (loc,
4247 too_many_p
4248 ? G_("too many arguments to member function %q#D")"too many arguments to member function %q#D"
4249 : G_("too few arguments to member function %q#D")"too few arguments to member function %q#D",
4250 fndecl);
4251 }
4252 else
4253 error_at (loc,
4254 too_many_p
4255 ? G_("too many arguments to function %q#D")"too many arguments to function %q#D"
4256 : G_("too few arguments to function %q#D")"too few arguments to function %q#D",
4257 fndecl);
4258 if (!DECL_IS_UNDECLARED_BUILTIN (fndecl)(((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4258, __FUNCTION__))->decl_minimal.locus) <= ((location_t
) 1))
)
4259 inform (DECL_SOURCE_LOCATION (fndecl)((contains_struct_check ((fndecl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4259, __FUNCTION__))->decl_minimal.locus)
, "declared here");
4260 }
4261 else
4262 {
4263 if (c_dialect_objc ()((c_language & clk_objc) != 0) && objc_message_selector ())
4264 error_at (loc,
4265 too_many_p
4266 ? G_("too many arguments to method %q#D")"too many arguments to method %q#D"
4267 : G_("too few arguments to method %q#D")"too few arguments to method %q#D",
4268 objc_message_selector ());
4269 else
4270 error_at (loc, too_many_p ? G_("too many arguments to function")"too many arguments to function"
4271 : G_("too few arguments to function")"too few arguments to function");
4272 }
4273}
4274
4275/* Convert the actual parameter expressions in the list VALUES to the
4276 types in the list TYPELIST. The converted expressions are stored
4277 back in the VALUES vector.
4278 If parmdecls is exhausted, or when an element has NULL as its type,
4279 perform the default conversions.
4280
4281 NAME is an IDENTIFIER_NODE or 0. It is used only for error messages.
4282
4283 This is also where warnings about wrong number of args are generated.
4284
4285 Returns the actual number of arguments processed (which might be less
4286 than the length of the vector), or -1 on error.
4287
4288 In C++, unspecified trailing parameters can be filled in with their
4289 default arguments, if such were specified. Do so here. */
4290
4291static int
4292convert_arguments (tree typelist, vec<tree, va_gc> **values, tree fndecl,
4293 int flags, tsubst_flags_t complain)
4294{
4295 tree typetail;
4296 unsigned int i;
4297
4298 /* Argument passing is always copy-initialization. */
4299 flags |= LOOKUP_ONLYCONVERTING(1 << 2);
4300
4301 for (i = 0, typetail = typelist;
4302 i < vec_safe_length (*values);
4303 i++)
4304 {
4305 tree type = typetail ? TREE_VALUE (typetail)((tree_check ((typetail), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4305, __FUNCTION__, (TREE_LIST)))->list.value)
: 0;
4306 tree val = (**values)[i];
4307
4308 if (val == error_mark_nodeglobal_trees[TI_ERROR_MARK] || type == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4309 return -1;
4310
4311 if (type == void_type_nodeglobal_trees[TI_VOID_TYPE])
4312 {
4313 if (complain & tf_error)
4314 {
4315 error_args_num (input_location, fndecl, /*too_many_p=*/true);
4316 return i;
4317 }
4318 else
4319 return -1;
4320 }
4321
4322 /* build_c_cast puts on a NOP_EXPR to make the result not an lvalue.
4323 Strip such NOP_EXPRs, since VAL is used in non-lvalue context. */
4324 if (TREE_CODE (val)((enum tree_code) (val)->base.code) == NOP_EXPR
4325 && TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4325, __FUNCTION__))->typed.type)
== TREE_TYPE (TREE_OPERAND (val, 0))((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((val), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4325, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4325, __FUNCTION__))->typed.type)
4326 && (type == 0 || !TYPE_REF_P (type)(((enum tree_code) (type)->base.code) == REFERENCE_TYPE)))
4327 val = TREE_OPERAND (val, 0)(*((const_cast<tree*> (tree_operand_check ((val), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4327, __FUNCTION__)))))
;
4328
4329 if (type == 0 || !TYPE_REF_P (type)(((enum tree_code) (type)->base.code) == REFERENCE_TYPE))
4330 {
4331 if (TREE_CODE (TREE_TYPE (val))((enum tree_code) (((contains_struct_check ((val), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4331, __FUNCTION__))->typed.type))->base.code)
== ARRAY_TYPE
4332 || FUNC_OR_METHOD_TYPE_P (TREE_TYPE (val))(((enum tree_code) (((contains_struct_check ((val), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4332, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (((contains_struct_check ((val), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4332, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)
)
4333 val = decay_conversion (val, complain);
4334 }
4335
4336 if (val == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4337 return -1;
4338
4339 if (type != 0)
4340 {
4341 /* Formal parm type is specified by a function prototype. */
4342 tree parmval;
4343
4344 if (!COMPLETE_TYPE_P (complete_type (type))(((tree_class_check ((complete_type (type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4344, __FUNCTION__))->type_common.size) != (tree) __null
)
)
4345 {
4346 if (complain & tf_error)
4347 {
4348 location_t loc = EXPR_LOC_OR_LOC (val, input_location)((((IS_ADHOC_LOC (((((val)) && ((tree_code_type[(int)
(((enum tree_code) ((val))->base.code))]) >= tcc_reference
&& (tree_code_type[(int) (((enum tree_code) ((val))->
base.code))]) <= tcc_expression)) ? (val)->exp.locus : (
(location_t) 0)))) ? get_location_from_adhoc_loc (line_table,
((((val)) && ((tree_code_type[(int) (((enum tree_code
) ((val))->base.code))]) >= tcc_reference && (tree_code_type
[(int) (((enum tree_code) ((val))->base.code))]) <= tcc_expression
)) ? (val)->exp.locus : ((location_t) 0))) : (((((val)) &&
((tree_code_type[(int) (((enum tree_code) ((val))->base.code
))]) >= tcc_reference && (tree_code_type[(int) (((
enum tree_code) ((val))->base.code))]) <= tcc_expression
)) ? (val)->exp.locus : ((location_t) 0)))) != ((location_t
) 0)) ? (val)->exp.locus : (input_location))
;
4349 if (fndecl)
4350 {
4351 auto_diagnostic_group d;
4352 error_at (loc,
4353 "parameter %P of %qD has incomplete type %qT",
4354 i, fndecl, type);
4355 inform (get_fndecl_argument_location (fndecl, i),
4356 " declared here");
4357 }
4358 else
4359 error_at (loc, "parameter %P has incomplete type %qT", i,
4360 type);
4361 }
4362 parmval = error_mark_nodeglobal_trees[TI_ERROR_MARK];
4363 }
4364 else
4365 {
4366 parmval = convert_for_initialization
4367 (NULL_TREE(tree) __null, type, val, flags,
4368 ICR_ARGPASS, fndecl, i, complain);
4369 parmval = convert_for_arg_passing (type, parmval, complain);
4370 }
4371
4372 if (parmval == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4373 return -1;
4374
4375 (**values)[i] = parmval;
4376 }
4377 else
4378 {
4379 if (fndecl && magic_varargs_p (fndecl))
4380 /* Don't do ellipsis conversion for __built_in_constant_p
4381 as this will result in spurious errors for non-trivial
4382 types. */
4383 val = require_complete_type_sfinae (val, complain);
4384 else
4385 val = convert_arg_to_ellipsis (val, complain);
4386
4387 (**values)[i] = val;
4388 }
4389
4390 if (typetail)
4391 typetail = TREE_CHAIN (typetail)((contains_struct_check ((typetail), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4391, __FUNCTION__))->common.chain)
;
4392 }
4393
4394 if (typetail != 0 && typetail != void_list_nodeglobal_trees[TI_VOID_LIST_NODE])
4395 {
4396 /* See if there are default arguments that can be used. Because
4397 we hold default arguments in the FUNCTION_TYPE (which is so
4398 wrong), we can see default parameters here from deduced
4399 contexts (and via typeof) for indirect function calls.
4400 Fortunately we know whether we have a function decl to
4401 provide default arguments in a language conformant
4402 manner. */
4403 if (fndecl && TREE_PURPOSE (typetail)((tree_check ((typetail), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4403, __FUNCTION__, (TREE_LIST)))->list.purpose)
4404 && TREE_CODE (TREE_PURPOSE (typetail))((enum tree_code) (((tree_check ((typetail), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4404, __FUNCTION__, (TREE_LIST)))->list.purpose))->base
.code)
!= DEFERRED_PARSE)
4405 {
4406 for (; typetail != void_list_nodeglobal_trees[TI_VOID_LIST_NODE]; ++i)
4407 {
4408 /* After DR777, with explicit template args we can end up with a
4409 default argument followed by no default argument. */
4410 if (!TREE_PURPOSE (typetail)((tree_check ((typetail), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4410, __FUNCTION__, (TREE_LIST)))->list.purpose)
)
4411 break;
4412 tree parmval
4413 = convert_default_arg (TREE_VALUE (typetail)((tree_check ((typetail), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4413, __FUNCTION__, (TREE_LIST)))->list.value)
,
4414 TREE_PURPOSE (typetail)((tree_check ((typetail), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4414, __FUNCTION__, (TREE_LIST)))->list.purpose)
,
4415 fndecl, i, complain);
4416
4417 if (parmval == error_mark_nodeglobal_trees[TI_ERROR_MARK])
4418 return -1;
4419
4420 vec_safe_push (*values, parmval);
4421 typetail = TREE_CHAIN (typetail)((contains_struct_check ((typetail), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4421, __FUNCTION__))->common.chain)
;
4422 /* ends with `...'. */
4423 if (typetail == NULL_TREE(tree) __null)
4424 break;
4425 }
4426 }
4427
4428 if (typetail && typetail != void_list_nodeglobal_trees[TI_VOID_LIST_NODE])
4429 {
4430 if (complain & tf_error)
4431 error_args_num (input_location, fndecl, /*too_many_p=*/false);
4432 return -1;
4433 }
4434 }
4435
4436 return (int) i;
4437}
4438
4439/* Build a binary-operation expression, after performing default
4440 conversions on the operands. CODE is the kind of expression to
4441 build. ARG1 and ARG2 are the arguments. ARG1_CODE and ARG2_CODE
4442 are the tree codes which correspond to ARG1 and ARG2 when issuing
4443 warnings about possibly misplaced parentheses. They may differ
4444 from the TREE_CODE of ARG1 and ARG2 if the parser has done constant
4445 folding (e.g., if the parser sees "a | 1 + 1", it may call this
4446 routine with ARG2 being an INTEGER_CST and ARG2_CODE == PLUS_EXPR).
4447 To avoid issuing any parentheses warnings, pass ARG1_CODE and/or
4448 ARG2_CODE as ERROR_MARK. */
4449
4450tree
4451build_x_binary_op (const op_location_t &loc, enum tree_code code, tree arg1,
4452 enum tree_code arg1_code, tree arg2,
4453 enum tree_code arg2_code, tree *overload_p,
4454 tsubst_flags_t complain)
4455{
4456 tree orig_arg1;
4457 tree orig_arg2;
4458 tree expr;
4459 tree overload = NULL_TREE(tree) __null;
4460
4461 orig_arg1 = arg1;
4462 orig_arg2 = arg2;
4463
4464 if (processing_template_declscope_chain->x_processing_template_decl)
4465 {
4466 if (type_dependent_expression_p (arg1)
4467 || type_dependent_expression_p (arg2))
4468 {
4469 expr = build_min_nt_loc (loc, code, arg1, arg2);
4470 maybe_save_operator_binding (expr);
4471 return expr;
4472 }
4473 arg1 = build_non_dependent_expr (arg1);
4474 arg2 = build_non_dependent_expr (arg2);
4475 }
4476
4477 if (code == DOTSTAR_EXPR)
4478 expr = build_m_component_ref (arg1, arg2, complain);
4479 else
4480 expr = build_new_op (loc, code, LOOKUP_NORMAL((1 << 0)), arg1, arg2, NULL_TREE(tree) __null,
4481 &overload, complain);
4482
4483 if (overload_p != NULL__null)
4484 *overload_p = overload;
4485
4486 /* Check for cases such as x+y<<z which users are likely to
4487 misinterpret. But don't warn about obj << x + y, since that is a
4488 common idiom for I/O. */
4489 if (warn_parenthesesglobal_options.x_warn_parentheses
4490 && (complain & tf_warning)
4491 && !processing_template_declscope_chain->x_processing_template_decl
4492 && !error_operand_p (arg1)
4493 && !error_operand_p (arg2)
4494 && (code != LSHIFT_EXPR
4495 || !CLASS_TYPE_P (TREE_TYPE (arg1))(((((enum tree_code) (((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4495, __FUNCTION__))->typed.type))->base.code)) == RECORD_TYPE
|| (((enum tree_code) (((contains_struct_check ((arg1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4495, __FUNCTION__))->typed.type))->base.code)) == UNION_TYPE
) && ((tree_class_check ((((contains_struct_check ((arg1
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4495, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4495, __FUNCTION__))->type_common.lang_flag_5))
))
4496 warn_about_parentheses (loc, code, arg1_code, orig_arg1,
4497 arg2_code, orig_arg2);
4498
4499 if (processing_template_declscope_chain->x_processing_template_decl && expr != error_mark_nodeglobal_trees[TI_ERROR_MARK])
4500 {
4501 if (overload != NULL_TREE(tree) __null)
4502 return (build_min_non_dep_op_overload
4503 (code, expr, overload, orig_arg1, orig_arg2));
4504
4505 return build_min_non_dep (code, expr, orig_arg1, orig_arg2);
4506 }
4507
4508 return expr;
4509}
4510
4511/* Build and return an ARRAY_REF expression. */
4512
4513tree
4514build_x_array_ref (location_t loc, tree arg1, tree arg2,
4515 tsubst_flags_t complain)
4516{
4517 tree orig_arg1 = arg1;
4518 tree orig_arg2 = arg2;
4519 tree expr;
4520 tree overload = NULL_TREE(tree) __null;
4521
4522 if (processing_template_declscope_chain->x_processing_template_decl)
4523 {
4524 if (type_dependent_expression_p (arg1)
4525 || type_dependent_expression_p (arg2))
4526 return build_min_nt_loc (loc, ARRAY_REF, arg1, arg2,
4527 NULL_TREE(tree) __null, NULL_TREE(tree) __null);
4528 arg1 = build_non_dependent_expr (arg1);
4529 arg2 = build_non_dependent_expr (arg2);
4530 }
4531
4532 expr = build_new_op (loc, ARRAY_REF, LOOKUP_NORMAL((1 << 0)), arg1, arg2,
4533 NULL_TREE(tree) __null, &overload, complain);
4534
4535 if (processing_template_declscope_chain->x_processing_template_decl && expr != error_mark_nodeglobal_trees[TI_ERROR_MARK])
4536 {
4537 if (overload != NULL_TREE(tree) __null)
4538 return (build_min_non_dep_op_overload
4539 (ARRAY_REF, expr, overload, orig_arg1, orig_arg2));
4540
4541 return build_min_non_dep (ARRAY_REF, expr, orig_arg1, orig_arg2,
4542 NULL_TREE(tree) __null, NULL_TREE(tree) __null);
4543 }
4544 return expr;
4545}
4546
4547/* Return whether OP is an expression of enum type cast to integer
4548 type. In C++ even unsigned enum types are cast to signed integer
4549 types. We do not want to issue warnings about comparisons between
4550 signed and unsigned types when one of the types is an enum type.
4551 Those warnings are always false positives in practice. */
4552
4553static bool
4554enum_cast_to_int (tree op)
4555{
4556 if (CONVERT_EXPR_P (op)((((enum tree_code) (op)->base.code)) == NOP_EXPR || (((enum
tree_code) (op)->base.code)) == CONVERT_EXPR)
4557 && TREE_TYPE (op)((contains_struct_check ((op), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4557, __FUNCTION__))->typed.type)
== integer_type_nodeinteger_types[itk_int]
4558 && TREE_CODE (TREE_TYPE (TREE_OPERAND (op, 0)))((enum tree_code) (((contains_struct_check (((*((const_cast<
tree*> (tree_operand_check ((op), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4558, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4558, __FUNCTION__))->typed.type))->base.code)
== ENUMERAL_TYPE
4559 && TYPE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op, 0)))((tree_class_check ((((contains_struct_check (((*((const_cast
<tree*> (tree_operand_check ((op), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4559, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4559, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4559, __FUNCTION__))->base.u.bits.unsigned_flag)
)
4560 return true;
4561
4562 /* The cast may have been pushed into a COND_EXPR. */
4563 if (TREE_CODE (op)((enum tree_code) (op)->base.code) == COND_EXPR)
4564 return (enum_cast_to_int (TREE_OPERAND (op, 1)(*((const_cast<tree*> (tree_operand_check ((op), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4564, __FUNCTION__)))))
)
4565 || enum_cast_to_int (TREE_OPERAND (op, 2)(*((const_cast<tree*> (tree_operand_check ((op), (2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4565, __FUNCTION__)))))
));
4566
4567 return false;
4568}
4569
4570/* For the c-common bits. */
4571tree
4572build_binary_op (location_t location, enum tree_code code, tree op0, tree op1,
4573 bool /*convert_p*/)
4574{
4575 return cp_build_binary_op (location, code, op0, op1, tf_warning_or_error);
4576}
4577
4578/* Build a vector comparison of ARG0 and ARG1 using CODE opcode
4579 into a value of TYPE type. Comparison is done via VEC_COND_EXPR. */
4580
4581static tree
4582build_vec_cmp (tree_code code, tree type,
4583 tree arg0, tree arg1)
4584{
4585 tree zero_vec = build_zero_cst (type);
4586 tree minus_one_vec = build_minus_one_cst (type);
4587 tree cmp_type = truth_type_for (type);
4588 tree cmp = build2 (code, cmp_type, arg0, arg1);
4589 return build3 (VEC_COND_EXPR, type, cmp, minus_one_vec, zero_vec);
4590}
4591
4592/* Possibly warn about an address never being NULL. */
4593
4594static void
4595warn_for_null_address (location_t location, tree op, tsubst_flags_t complain)
4596{
4597 /* Prevent warnings issued for macro expansion. */
4598 if (!warn_addressglobal_options.x_warn_address
4599 || (complain & tf_warning) == 0
4600 || c_inhibit_evaluation_warnings != 0
4601 || from_macro_expansion_at (location)
4602 || warning_suppressed_p (op, OPT_Waddress))
4603 return;
4604
4605 if (TREE_CODE (op)((enum tree_code) (op)->base.code) == NON_DEPENDENT_EXPR)
4606 op = TREE_OPERAND (op, 0)(*((const_cast<tree*> (tree_operand_check ((op), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4606, __FUNCTION__)))))
;
4607
4608 tree cop = fold_for_warn (op);
4609
4610 if (TREE_CODE (cop)((enum tree_code) (cop)->base.code) == NON_LVALUE_EXPR)
4611 /* Unwrap the expression for C++ 98. */
4612 cop = TREE_OPERAND (cop, 0)(*((const_cast<tree*> (tree_operand_check ((cop), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4612, __FUNCTION__)))))
;
4613
4614 if (TREE_CODE (cop)((enum tree_code) (cop)->base.code) == PTRMEM_CST)
4615 {
4616 /* The address of a nonstatic data member is never null. */
4617 warning_at (location, OPT_Waddress,
4618 "the address %qE will never be NULL",
4619 cop);
4620 return;
4621 }
4622
4623 if (TREE_CODE (cop)((enum tree_code) (cop)->base.code) == NOP_EXPR)
4624 {
4625 /* Allow casts to intptr_t to suppress the warning. */
4626 tree type = TREE_TYPE (cop)((contains_struct_check ((cop), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4626, __FUNCTION__))->typed.type)
;
4627 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == INTEGER_TYPE)
4628 return;
4629
4630 STRIP_NOPS (cop)(cop) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((cop)))))
;
4631 }
4632
4633 bool warned = false;
4634 if (TREE_CODE (cop)((enum tree_code) (cop)->base.code) == ADDR_EXPR)
4635 {
4636 cop = TREE_OPERAND (cop, 0)(*((const_cast<tree*> (tree_operand_check ((cop), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4636, __FUNCTION__)))))
;
4637
4638 /* Set to true in the loop below if OP dereferences its operand.
4639 In such a case the ultimate target need not be a decl for
4640 the null [in]equality test to be necessarily constant. */
4641 bool deref = false;
4642
4643 /* Get the outermost array or object, or member. */
4644 while (handled_component_p (cop))
4645 {
4646 if (TREE_CODE (cop)((enum tree_code) (cop)->base.code) == COMPONENT_REF)
4647 {
4648 /* Get the member (its address is never null). */
4649 cop = TREE_OPERAND (cop, 1)(*((const_cast<tree*> (tree_operand_check ((cop), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4649, __FUNCTION__)))))
;
4650 break;
4651 }
4652
4653 /* Get the outer array/object to refer to in the warning. */
4654 cop = TREE_OPERAND (cop, 0)(*((const_cast<tree*> (tree_operand_check ((cop), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4654, __FUNCTION__)))))
;
4655 deref = true;
4656 }
4657
4658 if ((!deref && !decl_with_nonnull_addr_p (cop))
4659 || from_macro_expansion_at (location)
4660 || warning_suppressed_p (cop, OPT_Waddress))
4661 return;
4662
4663 warned = warning_at (location, OPT_Waddress,
4664 "the address of %qD will never be NULL", cop);
4665 op = cop;
4666 }
4667 else if (TREE_CODE (cop)((enum tree_code) (cop)->base.code) == POINTER_PLUS_EXPR)
4668 {
4669 /* Adding zero to the null pointer is well-defined in C++. When
4670 the offset is unknown (i.e., not a constant) warn anyway since
4671 it's less likely that the pointer operand is null than not. */
4672 tree off = TREE_OPERAND (cop, 1)(*((const_cast<tree*> (tree_operand_check ((cop), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4672, __FUNCTION__)))))
;
4673 if (!integer_zerop (off)
4674 && !warning_suppressed_p (cop, OPT_Waddress))
4675 warning_at (location, OPT_Waddress, "comparing the result of pointer "
4676 "addition %qE and NULL", cop);
4677 return;
4678 }
4679 else if (CONVERT_EXPR_P (op)((((enum tree_code) (op)->base.code)) == NOP_EXPR || (((enum
tree_code) (op)->base.code)) == CONVERT_EXPR)
4680 && TYPE_REF_P (TREE_TYPE (TREE_OPERAND (op, 0)))(((enum tree_code) (((contains_struct_check (((*((const_cast<
tree*> (tree_operand_check ((op), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4680, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4680, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
)
)
4681 {
4682 STRIP_NOPS (op)(op) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((op)))))
;
4683
4684 if (DECL_P (op)(tree_code_type[(int) (((enum tree_code) (op)->base.code))
] == tcc_declaration)
)
4685 warned = warning_at (location, OPT_Waddress,
4686 "the compiler can assume that the address of "
4687 "%qD will never be NULL", op);
4688 }
4689
4690 if (warned && DECL_P (op)(tree_code_type[(int) (((enum tree_code) (op)->base.code))
] == tcc_declaration)
)
4691 inform (DECL_SOURCE_LOCATION (op)((contains_struct_check ((op), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/typeck.c"
, 4691, __FUNCTION__))->decl_minimal.locus)
, "%qD declared here", op);
4692}
4693
4694/* Warn about [expr.arith.conv]/2: If one operand is of enumeration type and
4695 the other operand is of a different enumeration type or a floating-point
4696 type, this behavior is deprecated ([depr.arith.conv.enum]). CODE is the
4697 code of the binary operation, TYPE0 and TYPE1 are the types of the operands,
4698 and LOC is the location for the whole binary expression.
4699 TODO: Consider combining this with -Wenum-compare in build_new_op_1. */
4700
4701static void
4702do_warn_enum_conversions (location_t loc, enum tree_code code, tree type0,
4703 tree type1)
4704{
4705 if (TREE_CODE (type0)