Bug Summary

File:build/gcc/vec.h
Warning:line 826, column 3
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 call.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-_3SGNE.plist -x c++ /home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c

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

1/* Functions related to invoking -*- C++ -*- methods and overloaded functions.
2 Copyright (C) 1987-2021 Free Software Foundation, Inc.
3 Contributed by Michael Tiemann (tiemann@cygnus.com) and
4 modified by Brendan Kehoe (brendan@cygnus.com).
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 3, or (at your option)
11any later version.
12
13GCC is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
21
22
23/* High-level class interface. */
24
25#include "config.h"
26#include "system.h"
27#include "coretypes.h"
28#include "target.h"
29#include "cp-tree.h"
30#include "timevar.h"
31#include "stringpool.h"
32#include "cgraph.h"
33#include "stor-layout.h"
34#include "trans-mem.h"
35#include "flags.h"
36#include "toplev.h"
37#include "intl.h"
38#include "convert.h"
39#include "langhooks.h"
40#include "c-family/c-objc.h"
41#include "internal-fn.h"
42#include "stringpool.h"
43#include "attribs.h"
44#include "gcc-rich-location.h"
45
46/* The various kinds of conversion. */
47
48enum conversion_kind {
49 ck_identity,
50 ck_lvalue,
51 ck_fnptr,
52 ck_qual,
53 ck_std,
54 ck_ptr,
55 ck_pmem,
56 ck_base,
57 ck_ref_bind,
58 ck_user,
59 ck_ambig,
60 ck_list,
61 ck_aggr,
62 ck_rvalue
63};
64
65/* The rank of the conversion. Order of the enumerals matters; better
66 conversions should come earlier in the list. */
67
68enum conversion_rank {
69 cr_identity,
70 cr_exact,
71 cr_promotion,
72 cr_std,
73 cr_pbool,
74 cr_user,
75 cr_ellipsis,
76 cr_bad
77};
78
79/* An implicit conversion sequence, in the sense of [over.best.ics].
80 The first conversion to be performed is at the end of the chain.
81 That conversion is always a cr_identity conversion. */
82
83struct conversion {
84 /* The kind of conversion represented by this step. */
85 conversion_kind kind;
86 /* The rank of this conversion. */
87 conversion_rank rank;
88 BOOL_BITFIELDunsigned int user_conv_p : 1;
89 BOOL_BITFIELDunsigned int ellipsis_p : 1;
90 BOOL_BITFIELDunsigned int this_p : 1;
91 /* True if this conversion would be permitted with a bending of
92 language standards, e.g. disregarding pointer qualifiers or
93 converting integers to pointers. */
94 BOOL_BITFIELDunsigned int bad_p : 1;
95 /* If KIND is ck_ref_bind or ck_base, true to indicate that a
96 temporary should be created to hold the result of the
97 conversion. If KIND is ck_ambig or ck_user, true means force
98 copy-initialization. */
99 BOOL_BITFIELDunsigned int need_temporary_p : 1;
100 /* If KIND is ck_ptr or ck_pmem, true to indicate that a conversion
101 from a pointer-to-derived to pointer-to-base is being performed. */
102 BOOL_BITFIELDunsigned int base_p : 1;
103 /* If KIND is ck_ref_bind, true when either an lvalue reference is
104 being bound to an lvalue expression or an rvalue reference is
105 being bound to an rvalue expression. If KIND is ck_rvalue or ck_base,
106 true when we are treating an lvalue as an rvalue (12.8p33). If
107 ck_identity, we will be binding a reference directly or decaying to
108 a pointer. */
109 BOOL_BITFIELDunsigned int rvaluedness_matches_p: 1;
110 BOOL_BITFIELDunsigned int check_narrowing: 1;
111 /* Whether check_narrowing should only check TREE_CONSTANTs; used
112 in build_converted_constant_expr. */
113 BOOL_BITFIELDunsigned int check_narrowing_const_only: 1;
114 /* True if this conversion is taking place in a copy-initialization context
115 and we should only consider converting constructors. Only set in
116 ck_base and ck_rvalue. */
117 BOOL_BITFIELDunsigned int copy_init_p : 1;
118 /* The type of the expression resulting from the conversion. */
119 tree type;
120 union {
121 /* The next conversion in the chain. Since the conversions are
122 arranged from outermost to innermost, the NEXT conversion will
123 actually be performed before this conversion. This variant is
124 used only when KIND is neither ck_identity, ck_aggr, ck_ambig nor
125 ck_list. Please use the next_conversion function instead
126 of using this field directly. */
127 conversion *next;
128 /* The expression at the beginning of the conversion chain. This
129 variant is used only if KIND is ck_identity, ck_aggr, or ck_ambig.
130 You can use conv_get_original_expr to get this expression. */
131 tree expr;
132 /* The array of conversions for an initializer_list, so this
133 variant is used only when KIN D is ck_list. */
134 conversion **list;
135 } u;
136 /* The function candidate corresponding to this conversion
137 sequence. This field is only used if KIND is ck_user. */
138 struct z_candidate *cand;
139};
140
141#define CONVERSION_RANK(NODE)((NODE)->bad_p ? cr_bad : (NODE)->ellipsis_p ? cr_ellipsis
: (NODE)->user_conv_p ? cr_user : (NODE)->rank)
\
142 ((NODE)->bad_p ? cr_bad \
143 : (NODE)->ellipsis_p ? cr_ellipsis \
144 : (NODE)->user_conv_p ? cr_user \
145 : (NODE)->rank)
146
147#define BAD_CONVERSION_RANK(NODE)((NODE)->ellipsis_p ? cr_ellipsis : (NODE)->user_conv_p
? cr_user : (NODE)->rank)
\
148 ((NODE)->ellipsis_p ? cr_ellipsis \
149 : (NODE)->user_conv_p ? cr_user \
150 : (NODE)->rank)
151
152static struct obstack conversion_obstack;
153static bool conversion_obstack_initialized;
154struct rejection_reason;
155
156static struct z_candidate * tourney (struct z_candidate *, tsubst_flags_t);
157static int equal_functions (tree, tree);
158static int joust (struct z_candidate *, struct z_candidate *, bool,
159 tsubst_flags_t);
160static int compare_ics (conversion *, conversion *);
161static void maybe_warn_class_memaccess (location_t, tree,
162 const vec<tree, va_gc> *);
163static tree build_over_call (struct z_candidate *, int, tsubst_flags_t);
164static tree convert_like (conversion *, tree, tsubst_flags_t);
165static tree convert_like_with_context (conversion *, tree, tree, int,
166 tsubst_flags_t);
167static void op_error (const op_location_t &, enum tree_code, enum tree_code,
168 tree, tree, tree, bool);
169static struct z_candidate *build_user_type_conversion_1 (tree, tree, int,
170 tsubst_flags_t);
171static void print_z_candidate (location_t, const char *, struct z_candidate *);
172static void print_z_candidates (location_t, struct z_candidate *);
173static tree build_this (tree);
174static struct z_candidate *splice_viable (struct z_candidate *, bool, bool *);
175static bool any_strictly_viable (struct z_candidate *);
176static struct z_candidate *add_template_candidate
177 (struct z_candidate **, tree, tree, tree, tree, const vec<tree, va_gc> *,
178 tree, tree, tree, int, unification_kind_t, bool, tsubst_flags_t);
179static struct z_candidate *add_template_candidate_real
180 (struct z_candidate **, tree, tree, tree, tree, const vec<tree, va_gc> *,
181 tree, tree, tree, int, tree, unification_kind_t, bool, tsubst_flags_t);
182static bool is_complete (tree);
183static struct z_candidate *add_conv_candidate
184 (struct z_candidate **, tree, tree, const vec<tree, va_gc> *, tree,
185 tree, tsubst_flags_t);
186static struct z_candidate *add_function_candidate
187 (struct z_candidate **, tree, tree, tree, const vec<tree, va_gc> *, tree,
188 tree, int, conversion**, bool, tsubst_flags_t);
189static conversion *implicit_conversion (tree, tree, tree, bool, int,
190 tsubst_flags_t);
191static conversion *reference_binding (tree, tree, tree, bool, int,
192 tsubst_flags_t);
193static conversion *build_conv (conversion_kind, tree, conversion *);
194static conversion *build_list_conv (tree, tree, int, tsubst_flags_t);
195static conversion *next_conversion (conversion *);
196static bool is_subseq (conversion *, conversion *);
197static conversion *maybe_handle_ref_bind (conversion **);
198static void maybe_handle_implicit_object (conversion **);
199static struct z_candidate *add_candidate
200 (struct z_candidate **, tree, tree, const vec<tree, va_gc> *, size_t,
201 conversion **, tree, tree, int, struct rejection_reason *, int);
202static tree source_type (conversion *);
203static void add_warning (struct z_candidate *, struct z_candidate *);
204static conversion *direct_reference_binding (tree, conversion *);
205static bool promoted_arithmetic_type_p (tree);
206static conversion *conditional_conversion (tree, tree, tsubst_flags_t);
207static char *name_as_c_string (tree, tree, bool *);
208static tree prep_operand (tree);
209static void add_candidates (tree, tree, const vec<tree, va_gc> *, tree, tree,
210 bool, tree, tree, int, struct z_candidate **,
211 tsubst_flags_t);
212static conversion *merge_conversion_sequences (conversion *, conversion *);
213static tree build_temp (tree, tree, int, diagnostic_t *, tsubst_flags_t);
214static conversion *build_identity_conv (tree, tree);
215static inline bool conv_binds_to_array_of_unknown_bound (conversion *);
216static bool conv_is_prvalue (conversion *);
217static tree prevent_lifetime_extension (tree);
218
219/* Returns nonzero iff the destructor name specified in NAME matches BASETYPE.
220 NAME can take many forms... */
221
222bool
223check_dtor_name (tree basetype, tree name)
224{
225 /* Just accept something we've already complained about. */
226 if (name == error_mark_nodeglobal_trees[TI_ERROR_MARK])
227 return true;
228
229 if (TREE_CODE (name)((enum tree_code) (name)->base.code) == TYPE_DECL)
230 name = TREE_TYPE (name)((contains_struct_check ((name), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 230, __FUNCTION__))->typed.type)
;
231 else if (TYPE_P (name)(tree_code_type[(int) (((enum tree_code) (name)->base.code
))] == tcc_type)
)
232 /* OK */;
233 else if (identifier_p (name))
234 {
235 if ((MAYBE_CLASS_TYPE_P (basetype)((((enum tree_code) (basetype)->base.code) == TEMPLATE_TYPE_PARM
|| ((enum tree_code) (basetype)->base.code) == TYPENAME_TYPE
|| ((enum tree_code) (basetype)->base.code) == TYPEOF_TYPE
|| ((enum tree_code) (basetype)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (basetype)->base.code) == DECLTYPE_TYPE
) || (((((enum tree_code) (basetype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (basetype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((basetype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 235, __FUNCTION__))->type_common.lang_flag_5)))
236 || TREE_CODE (basetype)((enum tree_code) (basetype)->base.code) == ENUMERAL_TYPE)
237 && name == constructor_name (basetype))
238 return true;
239
240 /* Otherwise lookup the name, it could be an unrelated typedef
241 of the correct type. */
242 name = lookup_name (name, LOOK_want::TYPE);
243 if (!name)
244 return false;
245 name = TREE_TYPE (name)((contains_struct_check ((name), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 245, __FUNCTION__))->typed.type)
;
246 if (name == error_mark_nodeglobal_trees[TI_ERROR_MARK])
247 return false;
248 }
249 else
250 {
251 /* In the case of:
252
253 template <class T> struct S { ~S(); };
254 int i;
255 i.~S();
256
257 NAME will be a class template. */
258 gcc_assert (DECL_CLASS_TEMPLATE_P (name))((void)(!(((((enum tree_code) (name)->base.code) == TEMPLATE_DECL
&& ((struct tree_template_decl *)(const_cast<union
tree_node *> ((((tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 258, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((name
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 258, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base
.code) == TYPE_DECL) && (((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((name
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 258, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->base
.code) == TYPE_DECL && ((contains_struct_check ((((struct
tree_template_decl *)(const_cast<union tree_node *> ((
((tree_check ((name), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 258, __FUNCTION__, (TEMPLATE_DECL))))))))->result), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 258, __FUNCTION__))->decl_common.lang_flag_2)))) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 258, __FUNCTION__), 0 : 0))
;
259 return false;
260 }
261
262 return same_type_p (TYPE_MAIN_VARIANT (basetype), TYPE_MAIN_VARIANT (name))comptypes ((((tree_class_check ((basetype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 262, __FUNCTION__))->type_common.main_variant)), (((tree_class_check
((name), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 262, __FUNCTION__))->type_common.main_variant)), 0)
;
263}
264
265/* We want the address of a function or method. We avoid creating a
266 pointer-to-member function. */
267
268tree
269build_addr_func (tree function, tsubst_flags_t complain)
270{
271 tree type = TREE_TYPE (function)((contains_struct_check ((function), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 271, __FUNCTION__))->typed.type)
;
272
273 /* We have to do these by hand to avoid real pointer to member
274 functions. */
275 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == METHOD_TYPE)
276 {
277 if (TREE_CODE (function)((enum tree_code) (function)->base.code) == OFFSET_REF)
278 {
279 tree object = build_address (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/call.c"
, 279, __FUNCTION__)))))
);
280 return get_member_function_from_ptrfunc (&object,
281 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/call.c"
, 281, __FUNCTION__)))))
,
282 complain);
283 }
284 function = build_address (function);
285 }
286 else if (TREE_CODE (function)((enum tree_code) (function)->base.code) == FUNCTION_DECL
287 && DECL_IMMEDIATE_FUNCTION_P (function)(((contains_struct_check (((tree_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/call.c"
, 287, __FUNCTION__, (TEMPLATE_DECL))))))))->result : function
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 287, __FUNCTION__, (FUNCTION_DECL)))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 287, __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/call.c"
, 287, __FUNCTION__, (TEMPLATE_DECL))))))))->result : function
)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 287, __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/call.c"
, 287, __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/call.c"
, 287, __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/call.c"
, 287, __FUNCTION__); &lt->u.fn; })->immediate_fn_p
: false)
)
288 function = build_address (function);
289 else
290 function = decay_conversion (function, complain, /*reject_builtin=*/false);
291
292 return function;
293}
294
295/* Build a CALL_EXPR, we can handle FUNCTION_TYPEs, METHOD_TYPEs, or
296 POINTER_TYPE to those. Note, pointer to member function types
297 (TYPE_PTRMEMFUNC_P) must be handled by our callers. There are
298 two variants. build_call_a is the primitive taking an array of
299 arguments, while build_call_n is a wrapper that handles varargs. */
300
301tree
302build_call_n (tree function, int n, ...)
303{
304 if (n == 0)
305 return build_call_a (function, 0, NULL__null);
306 else
307 {
308 tree *argarray = XALLOCAVEC (tree, n)((tree *) __builtin_alloca(sizeof (tree) * (n)));
309 va_list ap;
310 int i;
311
312 va_start (ap, n)__builtin_va_start(ap, n);
313 for (i = 0; i < n; i++)
314 argarray[i] = va_arg (ap, tree)__builtin_va_arg(ap, tree);
315 va_end (ap)__builtin_va_end(ap);
316 return build_call_a (function, n, argarray);
317 }
318}
319
320/* Update various flags in cfun and the call itself based on what is being
321 called. Split out of build_call_a so that bot_manip can use it too. */
322
323void
324set_flags_from_callee (tree call)
325{
326 /* Handle both CALL_EXPRs and AGGR_INIT_EXPRs. */
327 tree decl = cp_get_callee_fndecl_nofold (call);
328
329 /* We check both the decl and the type; a function may be known not to
330 throw without being declared throw(). */
331 bool nothrow = decl && TREE_NOTHROW (decl)((decl)->base.nothrow_flag);
332 tree callee = cp_get_callee (call);
333 if (callee)
334 nothrow |= TYPE_NOTHROW_P (TREE_TYPE (TREE_TYPE (callee)))nothrow_spec_p (((tree_class_check (((tree_check2 ((((contains_struct_check
((((contains_struct_check ((callee), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 334, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 334, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 334, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 334, __FUNCTION__))->type_non_common.lang_1))
;
335 else if (TREE_CODE (call)((enum tree_code) (call)->base.code) == CALL_EXPR
336 && internal_fn_flags (CALL_EXPR_IFN (call)((tree_check ((call), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 336, __FUNCTION__, (CALL_EXPR)))->base.u.ifn)
) & ECF_NOTHROW(1 << 6))
337 nothrow = true;
338
339 if (cfun(cfun + 0) && cp_function_chain((cfun + 0)->language) && !cp_unevaluated_operand)
340 {
341 if (!nothrow && at_function_scope_p ())
342 cp_function_chain((cfun + 0)->language)->can_throw = 1;
343
344 if (decl && TREE_THIS_VOLATILE (decl)((decl)->base.volatile_flag))
345 current_function_returns_abnormally((cfun + 0)->language)->returns_abnormally = 1;
346 }
347
348 TREE_NOTHROW (call)((call)->base.nothrow_flag) = nothrow;
349}
350
351tree
352build_call_a (tree function, int n, tree *argarray)
353{
354 tree decl;
355 tree result_type;
356 tree fntype;
357 int i;
358
359 function = build_addr_func (function, tf_warning_or_error);
360
361 gcc_assert (TYPE_PTR_P (TREE_TYPE (function)))((void)(!((((enum tree_code) (((contains_struct_check ((function
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 361, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 361, __FUNCTION__), 0 : 0))
;
362 fntype = TREE_TYPE (TREE_TYPE (function))((contains_struct_check ((((contains_struct_check ((function)
, (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 362, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 362, __FUNCTION__))->typed.type)
;
363 gcc_assert (FUNC_OR_METHOD_TYPE_P (fntype))((void)(!((((enum tree_code) (fntype)->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (fntype)->base.code) == METHOD_TYPE)
) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 363, __FUNCTION__), 0 : 0))
;
364 result_type = TREE_TYPE (fntype)((contains_struct_check ((fntype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 364, __FUNCTION__))->typed.type)
;
365 /* An rvalue has no cv-qualifiers. */
366 if (SCALAR_TYPE_P (result_type)((((enum tree_code) (result_type)->base.code) == OFFSET_TYPE
) || ((enum tree_code) (result_type)->base.code) == ENUMERAL_TYPE
|| ((((enum tree_code) (result_type)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (result_type)->base.code) == INTEGER_TYPE
) || ((enum tree_code) (result_type)->base.code) == REAL_TYPE
|| ((enum tree_code) (result_type)->base.code) == COMPLEX_TYPE
) || (((enum tree_code) (result_type)->base.code) == POINTER_TYPE
) || (((enum tree_code) (result_type)->base.code) == RECORD_TYPE
&& (((tree_class_check (((tree_check ((result_type),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 366, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 366, __FUNCTION__))->type_common.lang_flag_2))) || (((enum
tree_code) (result_type)->base.code) == NULLPTR_TYPE))
|| VOID_TYPE_P (result_type)(((enum tree_code) (result_type)->base.code) == VOID_TYPE))
367 result_type = cv_unqualified (result_type);
368
369 function = build_call_array_loc (input_location,
370 result_type, function, n, argarray);
371 set_flags_from_callee (function);
372
373 decl = get_callee_fndecl (function);
374
375 if (decl && !TREE_USED (decl)((decl)->base.used_flag))
376 {
377 /* We invoke build_call directly for several library
378 functions. These may have been declared normally if
379 we're building libgcc, so we can't just check
380 DECL_ARTIFICIAL. */
381 gcc_assert (DECL_ARTIFICIAL (decl)((void)(!(((contains_struct_check ((decl), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 381, __FUNCTION__))->decl_common.artificial_flag) || !strncmp
(((const char *) (tree_check ((((contains_struct_check ((decl
), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 382, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 382, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str
), "__", 2)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 383, __FUNCTION__), 0 : 0))
382 || !strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)),((void)(!(((contains_struct_check ((decl), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 381, __FUNCTION__))->decl_common.artificial_flag) || !strncmp
(((const char *) (tree_check ((((contains_struct_check ((decl
), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 382, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 382, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str
), "__", 2)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 383, __FUNCTION__), 0 : 0))
383 "__", 2))((void)(!(((contains_struct_check ((decl), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 381, __FUNCTION__))->decl_common.artificial_flag) || !strncmp
(((const char *) (tree_check ((((contains_struct_check ((decl
), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 382, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 382, __FUNCTION__, (IDENTIFIER_NODE)))->identifier.id.str
), "__", 2)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 383, __FUNCTION__), 0 : 0))
;
384 mark_used (decl);
385 }
386
387 require_complete_eh_spec_types (fntype, decl);
388
389 TREE_HAS_CONSTRUCTOR (function)(((tree_not_check2 ((function), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 389, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_4))
= (decl && DECL_CONSTRUCTOR_P (decl)((tree_check (((((enum tree_code) (decl)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((decl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 389, __FUNCTION__, (TEMPLATE_DECL))))))))->result : decl
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 389, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
);
390
391 /* Don't pass empty class objects by value. This is useful
392 for tags in STL, which are used to control overload resolution.
393 We don't need to handle other cases of copying empty classes. */
394 if (!decl || !fndecl_built_in_p (decl))
395 for (i = 0; i < n; i++)
396 {
397 tree arg = CALL_EXPR_ARG (function, i)(*((const_cast<tree*> (tree_operand_check (((tree_check
((function), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 397, __FUNCTION__, (CALL_EXPR)))), ((i) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 397, __FUNCTION__)))))
;
398 if (is_empty_class (TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 398, __FUNCTION__))->typed.type)
)
399 && simple_empty_class_p (TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 399, __FUNCTION__))->typed.type)
, arg, INIT_EXPR))
400 {
401 while (TREE_CODE (arg)((enum tree_code) (arg)->base.code) == TARGET_EXPR)
402 /* We're disconnecting the initializer from its target,
403 don't create a temporary. */
404 arg = TARGET_EXPR_INITIAL (arg)(*(tree_operand_check_code ((arg), (TARGET_EXPR), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 404, __FUNCTION__)))
;
405 tree t = build0 (EMPTY_CLASS_EXPR, TREE_TYPE (arg)((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 405, __FUNCTION__))->typed.type)
);
406 arg = build2 (COMPOUND_EXPR, TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 406, __FUNCTION__))->typed.type)
, arg, t);
407 CALL_EXPR_ARG (function, i)(*((const_cast<tree*> (tree_operand_check (((tree_check
((function), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 407, __FUNCTION__, (CALL_EXPR)))), ((i) + 3), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 407, __FUNCTION__)))))
= arg;
408 }
409 }
410
411 return function;
412}
413
414/* New overloading code. */
415
416struct z_candidate;
417
418struct candidate_warning {
419 z_candidate *loser;
420 candidate_warning *next;
421};
422
423/* Information for providing diagnostics about why overloading failed. */
424
425enum rejection_reason_code {
426 rr_none,
427 rr_arity,
428 rr_explicit_conversion,
429 rr_template_conversion,
430 rr_arg_conversion,
431 rr_bad_arg_conversion,
432 rr_template_unification,
433 rr_invalid_copy,
434 rr_inherited_ctor,
435 rr_constraint_failure
436};
437
438struct conversion_info {
439 /* The index of the argument, 0-based. */
440 int n_arg;
441 /* The actual argument or its type. */
442 tree from;
443 /* The type of the parameter. */
444 tree to_type;
445 /* The location of the argument. */
446 location_t loc;
447};
448
449struct rejection_reason {
450 enum rejection_reason_code code;
451 union {
452 /* Information about an arity mismatch. */
453 struct {
454 /* The expected number of arguments. */
455 int expected;
456 /* The actual number of arguments in the call. */
457 int actual;
458 /* Whether EXPECTED should be treated as a lower bound. */
459 bool least_p;
460 } arity;
461 /* Information about an argument conversion mismatch. */
462 struct conversion_info conversion;
463 /* Same, but for bad argument conversions. */
464 struct conversion_info bad_conversion;
465 /* Information about template unification failures. These are the
466 parameters passed to fn_type_unification. */
467 struct {
468 tree tmpl;
469 tree explicit_targs;
470 int num_targs;
471 const tree *args;
472 unsigned int nargs;
473 tree return_type;
474 unification_kind_t strict;
475 int flags;
476 } template_unification;
477 /* Information about template instantiation failures. These are the
478 parameters passed to instantiate_template. */
479 struct {
480 tree tmpl;
481 tree targs;
482 } template_instantiation;
483 } u;
484};
485
486struct z_candidate {
487 /* The FUNCTION_DECL that will be called if this candidate is
488 selected by overload resolution. */
489 tree fn;
490 /* If not NULL_TREE, the first argument to use when calling this
491 function. */
492 tree first_arg;
493 /* The rest of the arguments to use when calling this function. If
494 there are no further arguments this may be NULL or it may be an
495 empty vector. */
496 const vec<tree, va_gc> *args;
497 /* The implicit conversion sequences for each of the arguments to
498 FN. */
499 conversion **convs;
500 /* The number of implicit conversion sequences. */
501 size_t num_convs;
502 /* If FN is a user-defined conversion, the standard conversion
503 sequence from the type returned by FN to the desired destination
504 type. */
505 conversion *second_conv;
506 struct rejection_reason *reason;
507 /* If FN is a member function, the binfo indicating the path used to
508 qualify the name of FN at the call site. This path is used to
509 determine whether or not FN is accessible if it is selected by
510 overload resolution. The DECL_CONTEXT of FN will always be a
511 (possibly improper) base of this binfo. */
512 tree access_path;
513 /* If FN is a non-static member function, the binfo indicating the
514 subobject to which the `this' pointer should be converted if FN
515 is selected by overload resolution. The type pointed to by
516 the `this' pointer must correspond to the most derived class
517 indicated by the CONVERSION_PATH. */
518 tree conversion_path;
519 tree template_decl;
520 tree explicit_targs;
521 candidate_warning *warnings;
522 z_candidate *next;
523 int viable;
524
525 /* The flags active in add_candidate. */
526 int flags;
527
528 bool rewritten () const { return (flags & LOOKUP_REWRITTEN((((((((((((((1 << 6) << 1) << 1) << 1
) << 1) << 1) << 1) << 1) << 1)
<< 1) << 1) << 1) << 1) << 1)
); }
529 bool reversed () const { return (flags & LOOKUP_REVERSED(((((((((((((((1 << 6) << 1) << 1) <<
1) << 1) << 1) << 1) << 1) << 1
) << 1) << 1) << 1) << 1) << 1)
<< 1)
); }
530};
531
532/* Returns true iff T is a null pointer constant in the sense of
533 [conv.ptr]. */
534
535bool
536null_ptr_cst_p (tree t)
537{
538 tree type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 538, __FUNCTION__))->typed.type)
;
539
540 /* [conv.ptr]
541
542 A null pointer constant is an integer literal ([lex.icon]) with value
543 zero or a prvalue of type std::nullptr_t. */
544 if (NULLPTR_TYPE_P (type)(((enum tree_code) (type)->base.code) == NULLPTR_TYPE))
545 return true;
546
547 if (cxx_dialect >= cxx11)
548 {
549 STRIP_ANY_LOCATION_WRAPPER (t)(t) = tree_strip_any_location_wrapper ((const_cast<union tree_node
*> (((t)))))
;
550
551 /* Core issue 903 says only literal 0 is a null pointer constant. */
552 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == INTEGER_CST
553 && !TREE_OVERFLOW (t)((tree_class_check ((t), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 553, __FUNCTION__))->base.public_flag)
554 && TREE_CODE (type)((enum tree_code) (type)->base.code) == INTEGER_TYPE
555 && integer_zerop (t)
556 && !char_type_p (type))
557 return true;
558 }
559 else if (CP_INTEGRAL_TYPE_P (type)(((enum tree_code) (type)->base.code) == BOOLEAN_TYPE || (
(enum tree_code) (type)->base.code) == INTEGER_TYPE)
)
560 {
561 t = fold_non_dependent_expr (t, tf_none);
562 STRIP_NOPS (t)(t) = tree_strip_nop_conversions ((const_cast<union tree_node
*> (((t)))))
;
563 if (integer_zerop (t) && !TREE_OVERFLOW (t)((tree_class_check ((t), (tcc_constant), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 563, __FUNCTION__))->base.public_flag)
)
564 return true;
565 }
566
567 return false;
568}
569
570/* Returns true iff T is a null member pointer value (4.11). */
571
572bool
573null_member_pointer_value_p (tree t)
574{
575 tree type = TREE_TYPE (t)((contains_struct_check ((t), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 575, __FUNCTION__))->typed.type)
;
576 if (!type)
577 return false;
578 else if (TYPE_PTRMEMFUNC_P (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/call.c"
, 578, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 578, __FUNCTION__))->type_common.lang_flag_2)))
)
579 return (TREE_CODE (t)((enum tree_code) (t)->base.code) == CONSTRUCTOR
580 && CONSTRUCTOR_NELTS (t)(vec_safe_length (((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 580, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
581 && integer_zerop (CONSTRUCTOR_ELT (t, 0)(&(*((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 581, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[0
])
->value));
582 else if (TYPE_PTRDATAMEM_P (type)(((enum tree_code) (type)->base.code) == OFFSET_TYPE))
583 return integer_all_onesp (t);
584 else
585 return false;
586}
587
588/* Returns nonzero if PARMLIST consists of only default parms,
589 ellipsis, and/or undeduced parameter packs. */
590
591bool
592sufficient_parms_p (const_tree parmlist)
593{
594 for (; parmlist && parmlist != void_list_nodeglobal_trees[TI_VOID_LIST_NODE];
595 parmlist = TREE_CHAIN (parmlist)((contains_struct_check ((parmlist), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 595, __FUNCTION__))->common.chain)
)
596 if (!TREE_PURPOSE (parmlist)((tree_check ((parmlist), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 596, __FUNCTION__, (TREE_LIST)))->list.purpose)
597 && !PACK_EXPANSION_P (TREE_VALUE (parmlist))(((enum tree_code) (((tree_check ((parmlist), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 597, __FUNCTION__, (TREE_LIST)))->list.value))->base.
code) == TYPE_PACK_EXPANSION || ((enum tree_code) (((tree_check
((parmlist), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 597, __FUNCTION__, (TREE_LIST)))->list.value))->base.
code) == EXPR_PACK_EXPANSION)
)
598 return false;
599 return true;
600}
601
602/* Allocate N bytes of memory from the conversion obstack. The memory
603 is zeroed before being returned. */
604
605static void *
606conversion_obstack_alloc (size_t n)
607{
608 void *p;
609 if (!conversion_obstack_initialized)
610 {
611 gcc_obstack_init (&conversion_obstack)_obstack_begin (((&conversion_obstack)), (memory_block_pool
::block_size), (0), (mempool_obstack_chunk_alloc), (mempool_obstack_chunk_free
))
;
612 conversion_obstack_initialized = true;
613 }
614 p = obstack_alloc (&conversion_obstack, n)__extension__ ({ struct obstack *__h = (&conversion_obstack
); __extension__ ({ struct obstack *__o = (__h); size_t __len
= ((n)); if (__extension__ ({ struct obstack const *__o1 = (
__o); (size_t) (__o1->chunk_limit - __o1->next_free); }
) < __len) _obstack_newchunk (__o, __len); ((void) ((__o)->
next_free += (__len))); }); __extension__ ({ struct obstack *
__o1 = (__h); void *__value = (void *) __o1->object_base; if
(__o1->next_free == __value) __o1->maybe_empty_object =
1; __o1->next_free = (sizeof (ptrdiff_t) < sizeof (void
*) ? ((__o1->object_base) + (((__o1->next_free) - (__o1
->object_base) + (__o1->alignment_mask)) & ~(__o1->
alignment_mask))) : (char *) (((ptrdiff_t) (__o1->next_free
) + (__o1->alignment_mask)) & ~(__o1->alignment_mask
))); if ((size_t) (__o1->next_free - (char *) __o1->chunk
) > (size_t) (__o1->chunk_limit - (char *) __o1->chunk
)) __o1->next_free = __o1->chunk_limit; __o1->object_base
= __o1->next_free; __value; }); })
;
615 memset (p, 0, n);
616 return p;
617}
618
619/* Allocate rejection reasons. */
620
621static struct rejection_reason *
622alloc_rejection (enum rejection_reason_code code)
623{
624 struct rejection_reason *p;
625 p = (struct rejection_reason *) conversion_obstack_alloc (sizeof *p);
626 p->code = code;
627 return p;
628}
629
630static struct rejection_reason *
631arity_rejection (tree first_arg, int expected, int actual, bool least_p = false)
632{
633 struct rejection_reason *r = alloc_rejection (rr_arity);
634 int adjust = first_arg != NULL_TREE(tree) __null;
635 r->u.arity.expected = expected - adjust;
636 r->u.arity.actual = actual - adjust;
637 r->u.arity.least_p = least_p;
638 return r;
639}
640
641static struct rejection_reason *
642arg_conversion_rejection (tree first_arg, int n_arg, tree from, tree to,
643 location_t loc)
644{
645 struct rejection_reason *r = alloc_rejection (rr_arg_conversion);
646 int adjust = first_arg != NULL_TREE(tree) __null;
647 r->u.conversion.n_arg = n_arg - adjust;
648 r->u.conversion.from = from;
649 r->u.conversion.to_type = to;
650 r->u.conversion.loc = loc;
651 return r;
652}
653
654static struct rejection_reason *
655bad_arg_conversion_rejection (tree first_arg, int n_arg, tree from, tree to,
656 location_t loc)
657{
658 struct rejection_reason *r = alloc_rejection (rr_bad_arg_conversion);
659 int adjust = first_arg != NULL_TREE(tree) __null;
660 r->u.bad_conversion.n_arg = n_arg - adjust;
661 r->u.bad_conversion.from = from;
662 r->u.bad_conversion.to_type = to;
663 r->u.bad_conversion.loc = loc;
664 return r;
665}
666
667static struct rejection_reason *
668explicit_conversion_rejection (tree from, tree to)
669{
670 struct rejection_reason *r = alloc_rejection (rr_explicit_conversion);
671 r->u.conversion.n_arg = 0;
672 r->u.conversion.from = from;
673 r->u.conversion.to_type = to;
674 r->u.conversion.loc = UNKNOWN_LOCATION((location_t) 0);
675 return r;
676}
677
678static struct rejection_reason *
679template_conversion_rejection (tree from, tree to)
680{
681 struct rejection_reason *r = alloc_rejection (rr_template_conversion);
682 r->u.conversion.n_arg = 0;
683 r->u.conversion.from = from;
684 r->u.conversion.to_type = to;
685 r->u.conversion.loc = UNKNOWN_LOCATION((location_t) 0);
686 return r;
687}
688
689static struct rejection_reason *
690template_unification_rejection (tree tmpl, tree explicit_targs, tree targs,
691 const tree *args, unsigned int nargs,
692 tree return_type, unification_kind_t strict,
693 int flags)
694{
695 size_t args_n_bytes = sizeof (*args) * nargs;
696 tree *args1 = (tree *) conversion_obstack_alloc (args_n_bytes);
697 struct rejection_reason *r = alloc_rejection (rr_template_unification);
698 r->u.template_unification.tmpl = tmpl;
699 r->u.template_unification.explicit_targs = explicit_targs;
700 r->u.template_unification.num_targs = TREE_VEC_LENGTH (targs)((tree_check ((targs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 700, __FUNCTION__, (TREE_VEC)))->base.u.length)
;
701 /* Copy args to our own storage. */
702 memcpy (args1, args, args_n_bytes);
703 r->u.template_unification.args = args1;
704 r->u.template_unification.nargs = nargs;
705 r->u.template_unification.return_type = return_type;
706 r->u.template_unification.strict = strict;
707 r->u.template_unification.flags = flags;
708 return r;
709}
710
711static struct rejection_reason *
712template_unification_error_rejection (void)
713{
714 return alloc_rejection (rr_template_unification);
715}
716
717static struct rejection_reason *
718invalid_copy_with_fn_template_rejection (void)
719{
720 struct rejection_reason *r = alloc_rejection (rr_invalid_copy);
721 return r;
722}
723
724static struct rejection_reason *
725inherited_ctor_rejection (void)
726{
727 struct rejection_reason *r = alloc_rejection (rr_inherited_ctor);
728 return r;
729}
730
731/* Build a constraint failure record. */
732
733static struct rejection_reason *
734constraint_failure (void)
735{
736 struct rejection_reason *r = alloc_rejection (rr_constraint_failure);
737 return r;
738}
739
740/* Dynamically allocate a conversion. */
741
742static conversion *
743alloc_conversion (conversion_kind kind)
744{
745 conversion *c;
746 c = (conversion *) conversion_obstack_alloc (sizeof (conversion));
747 c->kind = kind;
748 return c;
749}
750
751/* Make sure that all memory on the conversion obstack has been
752 freed. */
753
754void
755validate_conversion_obstack (void)
756{
757 if (conversion_obstack_initialized)
758 gcc_assert ((obstack_next_free (&conversion_obstack)((void)(!((((void *) (&conversion_obstack)->next_free)
== ((void *) (&conversion_obstack)->object_base))) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 759, __FUNCTION__), 0 : 0))
759 == obstack_base (&conversion_obstack)))((void)(!((((void *) (&conversion_obstack)->next_free)
== ((void *) (&conversion_obstack)->object_base))) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 759, __FUNCTION__), 0 : 0))
;
760}
761
762/* Dynamically allocate an array of N conversions. */
763
764static conversion **
765alloc_conversions (size_t n)
766{
767 return (conversion **) conversion_obstack_alloc (n * sizeof (conversion *));
768}
769
770/* True iff the active member of conversion::u for code CODE is NEXT. */
771
772static inline bool
773has_next (conversion_kind code)
774{
775 return !(code == ck_identity
776 || code == ck_ambig
777 || code == ck_list
778 || code == ck_aggr);
779}
780
781static conversion *
782build_conv (conversion_kind code, tree type, conversion *from)
783{
784 conversion *t;
785 conversion_rank rank = CONVERSION_RANK (from)((from)->bad_p ? cr_bad : (from)->ellipsis_p ? cr_ellipsis
: (from)->user_conv_p ? cr_user : (from)->rank)
;
786
787 /* Only call this function for conversions that use u.next. */
788 gcc_assert (from == NULL || has_next (code))((void)(!(from == __null || has_next (code)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 788, __FUNCTION__), 0 : 0))
;
789
790 /* Note that the caller is responsible for filling in t->cand for
791 user-defined conversions. */
792 t = alloc_conversion (code);
793 t->type = type;
794 t->u.next = from;
795
796 switch (code)
797 {
798 case ck_ptr:
799 case ck_pmem:
800 case ck_base:
801 case ck_std:
802 if (rank < cr_std)
803 rank = cr_std;
804 break;
805
806 case ck_qual:
807 case ck_fnptr:
808 if (rank < cr_exact)
809 rank = cr_exact;
810 break;
811
812 default:
813 break;
814 }
815 t->rank = rank;
816 t->user_conv_p = (code == ck_user || from->user_conv_p);
817 t->bad_p = from->bad_p;
818 t->base_p = false;
819 return t;
820}
821
822/* Represent a conversion from CTOR, a braced-init-list, to TYPE, a
823 specialization of std::initializer_list<T>, if such a conversion is
824 possible. */
825
826static conversion *
827build_list_conv (tree type, tree ctor, int flags, tsubst_flags_t complain)
828{
829 tree elttype = TREE_VEC_ELT (CLASSTYPE_TI_ARGS (type), 0)(*((const_cast<tree *> (tree_vec_elt_check ((((struct tree_template_info
*)(tree_check (((((tree_class_check (((tree_check3 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 829, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 829, __FUNCTION__))->type_non_common.lang_1))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 829, __FUNCTION__, (TEMPLATE_INFO))))->args), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 829, __FUNCTION__)))))
;
830 unsigned len = CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 830, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
;
831 conversion **subconvs = alloc_conversions (len);
832 conversion *t;
833 unsigned i;
834 tree val;
835
836 /* Within a list-initialization we can have more user-defined
837 conversions. */
838 flags &= ~LOOKUP_NO_CONVERSION(1 << 4);
839 /* But no narrowing conversions. */
840 flags |= LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1);
841
842 /* Can't make an array of these types. */
843 if (TYPE_REF_P (elttype)(((enum tree_code) (elttype)->base.code) == REFERENCE_TYPE
)
844 || TREE_CODE (elttype)((enum tree_code) (elttype)->base.code) == FUNCTION_TYPE
845 || VOID_TYPE_P (elttype)(((enum tree_code) (elttype)->base.code) == VOID_TYPE))
846 return NULL__null;
847
848 FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (ctor), i, val)for (i = 0; (i >= vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 848, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))) ?
false : ((val = (*(((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 848, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))[
i].value), true); (i)++)
849 {
850 conversion *sub
851 = implicit_conversion (elttype, TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 851, __FUNCTION__))->typed.type)
, val,
852 false, flags, complain);
853 if (sub == NULL__null)
854 return NULL__null;
855
856 subconvs[i] = sub;
857 }
858
859 t = alloc_conversion (ck_list);
860 t->type = type;
861 t->u.list = subconvs;
862 t->rank = cr_exact;
863
864 for (i = 0; i < len; ++i)
865 {
866 conversion *sub = subconvs[i];
867 if (sub->rank > t->rank)
868 t->rank = sub->rank;
869 if (sub->user_conv_p)
870 t->user_conv_p = true;
871 if (sub->bad_p)
872 t->bad_p = true;
873 }
874
875 return t;
876}
877
878/* Return the next conversion of the conversion chain (if applicable),
879 or NULL otherwise. Please use this function instead of directly
880 accessing fields of struct conversion. */
881
882static conversion *
883next_conversion (conversion *conv)
884{
885 if (conv == NULL__null
886 || !has_next (conv->kind))
887 return NULL__null;
888 return conv->u.next;
889}
890
891/* Strip to the first ck_user, ck_ambig, ck_list, ck_aggr or ck_identity
892 encountered. */
893
894static conversion *
895strip_standard_conversion (conversion *conv)
896{
897 while (conv
898 && conv->kind != ck_user
899 && has_next (conv->kind))
900 conv = next_conversion (conv);
901 return conv;
902}
903
904/* Subroutine of build_aggr_conv: check whether FROM is a valid aggregate
905 initializer for array type ATYPE. */
906
907static bool
908can_convert_array (tree atype, tree from, int flags, tsubst_flags_t complain)
909{
910 tree elttype = TREE_TYPE (atype)((contains_struct_check ((atype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 910, __FUNCTION__))->typed.type)
;
911 unsigned i;
912
913 if (TREE_CODE (from)((enum tree_code) (from)->base.code) == CONSTRUCTOR)
914 {
915 for (i = 0; i < CONSTRUCTOR_NELTS (from)(vec_safe_length (((tree_check ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 915, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
; ++i)
916 {
917 tree val = CONSTRUCTOR_ELT (from, i)(&(*((tree_check ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 917, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[i
])
->value;
918 bool ok;
919 if (TREE_CODE (elttype)((enum tree_code) (elttype)->base.code) == ARRAY_TYPE)
920 ok = can_convert_array (elttype, val, flags, complain);
921 else
922 ok = can_convert_arg (elttype, TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 922, __FUNCTION__))->typed.type)
, val, flags,
923 complain);
924 if (!ok)
925 return false;
926 }
927 return true;
928 }
929
930 if (char_type_p (TYPE_MAIN_VARIANT (elttype)((tree_class_check ((elttype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 930, __FUNCTION__))->type_common.main_variant)
)
931 && TREE_CODE (tree_strip_any_location_wrapper (from))((enum tree_code) (tree_strip_any_location_wrapper (from))->
base.code)
== STRING_CST)
932 return array_string_literal_compatible_p (atype, from);
933
934 /* No other valid way to aggregate initialize an array. */
935 return false;
936}
937
938/* Helper for build_aggr_conv. Return true if FIELD is in PSET, or if
939 FIELD has ANON_AGGR_TYPE_P and any initializable field in there recursively
940 is in PSET. */
941
942static bool
943field_in_pset (hash_set<tree, true> &pset, tree field)
944{
945 if (pset.contains (field))
946 return true;
947 if (ANON_AGGR_TYPE_P (TREE_TYPE (field))((((((enum tree_code) (((contains_struct_check ((field), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 947, __FUNCTION__))->typed.type))->base.code)) == RECORD_TYPE
|| (((enum tree_code) (((contains_struct_check ((field), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 947, __FUNCTION__))->typed.type))->base.code)) == UNION_TYPE
) && ((tree_class_check ((((contains_struct_check ((field
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 947, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 947, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((((contains_struct_check ((field), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 947, __FUNCTION__))->typed.type)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 947, __FUNCTION__))->type_with_lang_specific.lang_specific
))->anon_aggr)
)
948 for (field = TYPE_FIELDS (TREE_TYPE (field))((tree_check3 ((((contains_struct_check ((field), (TS_TYPED),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 948, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 948, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
;
949 field; field = DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 949, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 949, __FUNCTION__))->common.chain))
)
950 {
951 field = next_initializable_field (field);
952 if (field == NULL_TREE(tree) __null)
953 break;
954 if (field_in_pset (pset, field))
955 return true;
956 }
957 return false;
958}
959
960/* Represent a conversion from CTOR, a braced-init-list, to TYPE, an
961 aggregate class, if such a conversion is possible. */
962
963static conversion *
964build_aggr_conv (tree type, tree ctor, int flags, tsubst_flags_t complain)
965{
966 unsigned HOST_WIDE_INTlong i = 0;
967 conversion *c;
968 tree field = next_initializable_field (TYPE_FIELDS (type)((tree_check3 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 968, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.values)
);
969 tree empty_ctor = NULL_TREE(tree) __null;
970 hash_set<tree, true> pset;
971
972 /* We already called reshape_init in implicit_conversion. */
973
974 /* The conversions within the init-list aren't affected by the enclosing
975 context; they're always simple copy-initialization. */
976 flags = LOOKUP_IMPLICIT(((1 << 0)) | (1 << 2))|LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1);
977
978 /* For designated initializers, verify that each initializer is convertible
979 to corresponding TREE_TYPE (ce->index) and mark those FIELD_DECLs as
980 visited. In the following loop then ignore already visited
981 FIELD_DECLs. */
982 if (CONSTRUCTOR_IS_DESIGNATED_INIT (ctor)(((tree_not_check2 (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 982, __FUNCTION__, (CONSTRUCTOR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 982, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_6))
)
983 {
984 tree idx, val;
985 FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (ctor), i, idx, val)for (i = 0; (i >= vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 985, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))) ?
false : (((void) (val = (*((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 985, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[i
].value)), (idx = (*((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 985, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[i
].index), true); (i)++)
986 {
987 if (idx && TREE_CODE (idx)((enum tree_code) (idx)->base.code) == FIELD_DECL)
988 {
989 tree ftype = TREE_TYPE (idx)((contains_struct_check ((idx), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 989, __FUNCTION__))->typed.type)
;
990 bool ok;
991
992 if (TREE_CODE (ftype)((enum tree_code) (ftype)->base.code) == ARRAY_TYPE)
993 ok = can_convert_array (ftype, val, flags, complain);
994 else
995 ok = can_convert_arg (ftype, TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 995, __FUNCTION__))->typed.type)
, val, flags,
996 complain);
997
998 if (!ok)
999 return NULL__null;
1000 /* For unions, there should be just one initializer. */
1001 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == UNION_TYPE)
1002 {
1003 field = NULL_TREE(tree) __null;
1004 i = 1;
1005 break;
1006 }
1007 pset.add (idx);
1008 }
1009 else
1010 return NULL__null;
1011 }
1012 }
1013
1014 for (; field; field = next_initializable_field (DECL_CHAIN (field)(((contains_struct_check (((contains_struct_check ((field), (
TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1014, __FUNCTION__))), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1014, __FUNCTION__))->common.chain))
))
1015 {
1016 tree ftype = TREE_TYPE (field)((contains_struct_check ((field), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1016, __FUNCTION__))->typed.type)
;
1017 tree val;
1018 bool ok;
1019
1020 if (!pset.is_empty () && field_in_pset (pset, field))
1021 continue;
1022 if (i < CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1022, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
)
1023 {
1024 val = CONSTRUCTOR_ELT (ctor, i)(&(*((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1024, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
i])
->value;
1025 ++i;
1026 }
1027 else if (DECL_INITIAL (field)((contains_struct_check ((field), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1027, __FUNCTION__))->decl_common.initial)
)
1028 val = get_nsdmi (field, /*ctor*/false, complain);
1029 else if (TYPE_REF_P (ftype)(((enum tree_code) (ftype)->base.code) == REFERENCE_TYPE))
1030 /* Value-initialization of reference is ill-formed. */
1031 return NULL__null;
1032 else
1033 {
1034 if (empty_ctor == NULL_TREE(tree) __null)
1035 empty_ctor = build_constructor (init_list_type_nodecp_global_trees[CPTI_INIT_LIST_TYPE], NULL__null);
1036 val = empty_ctor;
1037 }
1038
1039 if (TREE_CODE (ftype)((enum tree_code) (ftype)->base.code) == ARRAY_TYPE)
1040 ok = can_convert_array (ftype, val, flags, complain);
1041 else
1042 ok = can_convert_arg (ftype, TREE_TYPE (val)((contains_struct_check ((val), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1042, __FUNCTION__))->typed.type)
, val, flags,
1043 complain);
1044
1045 if (!ok)
1046 return NULL__null;
1047
1048 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == UNION_TYPE)
1049 break;
1050 }
1051
1052 if (i < CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1052, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
)
1053 return NULL__null;
1054
1055 c = alloc_conversion (ck_aggr);
1056 c->type = type;
1057 c->rank = cr_exact;
1058 c->user_conv_p = true;
1059 c->check_narrowing = true;
1060 c->u.expr = ctor;
1061 return c;
1062}
1063
1064/* Represent a conversion from CTOR, a braced-init-list, to TYPE, an
1065 array type, if such a conversion is possible. */
1066
1067static conversion *
1068build_array_conv (tree type, tree ctor, int flags, tsubst_flags_t complain)
1069{
1070 conversion *c;
1071 unsigned HOST_WIDE_INTlong len = CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1071, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
;
1072 tree elttype = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1072, __FUNCTION__))->typed.type)
;
1073 bool bad = false;
1074 bool user = false;
1075 enum conversion_rank rank = cr_exact;
1076
1077 /* We might need to propagate the size from the element to the array. */
1078 complete_type (type);
1079
1080 if (TYPE_DOMAIN (type)((tree_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1080, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
1081 && !variably_modified_type_p (TYPE_DOMAIN (type)((tree_check ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1081, __FUNCTION__, (ARRAY_TYPE)))->type_non_common.values
)
, NULL_TREE(tree) __null))
1082 {
1083 unsigned HOST_WIDE_INTlong alen = tree_to_uhwi (array_type_nelts_top (type));
1084 if (alen < len)
1085 return NULL__null;
1086 }
1087
1088 flags = LOOKUP_IMPLICIT(((1 << 0)) | (1 << 2))|LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1);
1089
1090 for (auto &e: CONSTRUCTOR_ELTS (ctor)((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1090, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
)
1091 {
1092 conversion *sub
1093 = implicit_conversion (elttype, TREE_TYPE (e.value)((contains_struct_check ((e.value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1093, __FUNCTION__))->typed.type)
, e.value,
1094 false, flags, complain);
1095 if (sub == NULL__null)
1096 return NULL__null;
1097
1098 if (sub->rank > rank)
1099 rank = sub->rank;
1100 if (sub->user_conv_p)
1101 user = true;
1102 if (sub->bad_p)
1103 bad = true;
1104 }
1105
1106 c = alloc_conversion (ck_aggr);
1107 c->type = type;
1108 c->rank = rank;
1109 c->user_conv_p = user;
1110 c->bad_p = bad;
1111 c->u.expr = ctor;
1112 return c;
1113}
1114
1115/* Represent a conversion from CTOR, a braced-init-list, to TYPE, a
1116 complex type, if such a conversion is possible. */
1117
1118static conversion *
1119build_complex_conv (tree type, tree ctor, int flags,
1120 tsubst_flags_t complain)
1121{
1122 conversion *c;
1123 unsigned HOST_WIDE_INTlong len = CONSTRUCTOR_NELTS (ctor)(vec_safe_length (((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1123, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
;
1124 tree elttype = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1124, __FUNCTION__))->typed.type)
;
1125 bool bad = false;
1126 bool user = false;
1127 enum conversion_rank rank = cr_exact;
1128
1129 if (len != 2)
1130 return NULL__null;
1131
1132 flags = LOOKUP_IMPLICIT(((1 << 0)) | (1 << 2))|LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1);
1133
1134 for (auto &e: CONSTRUCTOR_ELTS (ctor)((tree_check ((ctor), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1134, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)
)
1135 {
1136 conversion *sub
1137 = implicit_conversion (elttype, TREE_TYPE (e.value)((contains_struct_check ((e.value), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1137, __FUNCTION__))->typed.type)
, e.value,
1138 false, flags, complain);
1139 if (sub == NULL__null)
1140 return NULL__null;
1141
1142 if (sub->rank > rank)
1143 rank = sub->rank;
1144 if (sub->user_conv_p)
1145 user = true;
1146 if (sub->bad_p)
1147 bad = true;
1148 }
1149
1150 c = alloc_conversion (ck_aggr);
1151 c->type = type;
1152 c->rank = rank;
1153 c->user_conv_p = user;
1154 c->bad_p = bad;
1155 c->u.expr = ctor;
1156 return c;
1157}
1158
1159/* Build a representation of the identity conversion from EXPR to
1160 itself. The TYPE should match the type of EXPR, if EXPR is non-NULL. */
1161
1162static conversion *
1163build_identity_conv (tree type, tree expr)
1164{
1165 conversion *c;
1166
1167 c = alloc_conversion (ck_identity);
1168 c->type = type;
1169 c->u.expr = expr;
1170
1171 return c;
1172}
1173
1174/* Converting from EXPR to TYPE was ambiguous in the sense that there
1175 were multiple user-defined conversions to accomplish the job.
1176 Build a conversion that indicates that ambiguity. */
1177
1178static conversion *
1179build_ambiguous_conv (tree type, tree expr)
1180{
1181 conversion *c;
1182
1183 c = alloc_conversion (ck_ambig);
1184 c->type = type;
1185 c->u.expr = expr;
1186
1187 return c;
1188}
1189
1190tree
1191strip_top_quals (tree t)
1192{
1193 if (TREE_CODE (t)((enum tree_code) (t)->base.code) == ARRAY_TYPE)
1194 return t;
1195 return cp_build_qualified_type (t, 0)cp_build_qualified_type_real ((t), (0), tf_warning_or_error);
1196}
1197
1198/* Returns the standard conversion path (see [conv]) from type FROM to type
1199 TO, if any. For proper handling of null pointer constants, you must
1200 also pass the expression EXPR to convert from. If C_CAST_P is true,
1201 this conversion is coming from a C-style cast. */
1202
1203static conversion *
1204standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
1205 int flags, tsubst_flags_t complain)
1206{
1207 enum tree_code fcode, tcode;
1208 conversion *conv;
1209 bool fromref = false;
1210 tree qualified_to;
1211
1212 to = non_reference (to);
1213 if (TYPE_REF_P (from)(((enum tree_code) (from)->base.code) == REFERENCE_TYPE))
1214 {
1215 fromref = true;
1216 from = TREE_TYPE (from)((contains_struct_check ((from), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1216, __FUNCTION__))->typed.type)
;
1217 }
1218 qualified_to = to;
1219 to = strip_top_quals (to);
1220 from = strip_top_quals (from);
1221
1222 if (expr && type_unknown_p (expr))
1223 {
1224 if (TYPE_PTRFN_P (to)((((enum tree_code) (to)->base.code) == POINTER_TYPE) &&
((enum tree_code) (((contains_struct_check ((to), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1224, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
)
|| TYPE_PTRMEMFUNC_P (to)(((enum tree_code) (to)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1224, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1224, __FUNCTION__))->type_common.lang_flag_2)))
)
1225 {
1226 tsubst_flags_t tflags = tf_conv;
1227 expr = instantiate_type (to, expr, tflags);
1228 if (expr == error_mark_nodeglobal_trees[TI_ERROR_MARK])
1229 return NULL__null;
1230 from = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1230, __FUNCTION__))->typed.type)
;
1231 }
1232 else if (TREE_CODE (to)((enum tree_code) (to)->base.code) == BOOLEAN_TYPE)
1233 {
1234 /* Necessary for eg, TEMPLATE_ID_EXPRs (c++/50961). */
1235 expr = resolve_nondeduced_context (expr, complain);
1236 from = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1236, __FUNCTION__))->typed.type)
;
1237 }
1238 }
1239
1240 fcode = TREE_CODE (from)((enum tree_code) (from)->base.code);
1241 tcode = TREE_CODE (to)((enum tree_code) (to)->base.code);
1242
1243 conv = build_identity_conv (from, expr);
1244 if (fcode == FUNCTION_TYPE || fcode == ARRAY_TYPE)
1245 {
1246 from = type_decays_to (from);
1247 fcode = TREE_CODE (from)((enum tree_code) (from)->base.code);
1248 /* Tell convert_like that we're using the address. */
1249 conv->rvaluedness_matches_p = true;
1250 conv = build_conv (ck_lvalue, from, conv);
1251 }
1252 /* Wrapping a ck_rvalue around a class prvalue (as a result of using
1253 obvalue_p) seems odd, since it's already a prvalue, but that's how we
1254 express the copy constructor call required by copy-initialization. */
1255 else if (fromref || (expr && obvalue_p (expr)))
1256 {
1257 if (expr)
1258 {
1259 tree bitfield_type;
1260 bitfield_type = is_bitfield_expr_with_lowered_type (expr);
1261 if (bitfield_type)
1262 {
1263 from = strip_top_quals (bitfield_type);
1264 fcode = TREE_CODE (from)((enum tree_code) (from)->base.code);
1265 }
1266 }
1267 conv = build_conv (ck_rvalue, from, conv);
1268 if (flags & LOOKUP_PREFER_RVALUE((1 << 6) << 1))
1269 /* Tell convert_like to set LOOKUP_PREFER_RVALUE. */
1270 conv->rvaluedness_matches_p = true;
1271 /* If we're performing copy-initialization, remember to skip
1272 explicit constructors. */
1273 if (flags & LOOKUP_ONLYCONVERTING(1 << 2))
1274 conv->copy_init_p = true;
1275 }
1276
1277 /* Allow conversion between `__complex__' data types. */
1278 if (tcode == COMPLEX_TYPE && fcode == COMPLEX_TYPE)
1279 {
1280 /* The standard conversion sequence to convert FROM to TO is
1281 the standard conversion sequence to perform componentwise
1282 conversion. */
1283 conversion *part_conv = standard_conversion
1284 (TREE_TYPE (to)((contains_struct_check ((to), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1284, __FUNCTION__))->typed.type)
, TREE_TYPE (from)((contains_struct_check ((from), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1284, __FUNCTION__))->typed.type)
, NULL_TREE(tree) __null, c_cast_p, flags,
1285 complain);
1286
1287 if (!part_conv)
1288 conv = NULL__null;
1289 else if (part_conv->kind == ck_identity)
1290 /* Leave conv alone. */;
1291 else
1292 {
1293 conv = build_conv (part_conv->kind, to, conv);
1294 conv->rank = part_conv->rank;
1295 }
1296
1297 return conv;
1298 }
1299
1300 if (same_type_p (from, to)comptypes ((from), (to), 0))
1301 {
1302 if (CLASS_TYPE_P (to)(((((enum tree_code) (to)->base.code)) == RECORD_TYPE || (
((enum tree_code) (to)->base.code)) == UNION_TYPE) &&
((tree_class_check ((to), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1302, __FUNCTION__))->type_common.lang_flag_5))
&& conv->kind == ck_rvalue)
1303 conv->type = qualified_to;
1304 return conv;
1305 }
1306
1307 /* [conv.ptr]
1308 A null pointer constant can be converted to a pointer type; ... A
1309 null pointer constant of integral type can be converted to an
1310 rvalue of type std::nullptr_t. */
1311 if ((tcode == POINTER_TYPE || TYPE_PTRMEM_P (to)((((enum tree_code) (to)->base.code) == OFFSET_TYPE) || ((
(enum tree_code) (to)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1311, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1311, __FUNCTION__))->type_common.lang_flag_2))))
1312 || NULLPTR_TYPE_P (to)(((enum tree_code) (to)->base.code) == NULLPTR_TYPE))
1313 && ((expr && null_ptr_cst_p (expr))
1314 || NULLPTR_TYPE_P (from)(((enum tree_code) (from)->base.code) == NULLPTR_TYPE)))
1315 conv = build_conv (ck_std, to, conv);
1316 else if ((tcode == INTEGER_TYPE && fcode == POINTER_TYPE)
1317 || (tcode == POINTER_TYPE && fcode == INTEGER_TYPE))
1318 {
1319 /* For backwards brain damage compatibility, allow interconversion of
1320 pointers and integers with a pedwarn. */
1321 conv = build_conv (ck_std, to, conv);
1322 conv->bad_p = true;
1323 }
1324 else if (UNSCOPED_ENUM_P (to)(((enum tree_code) (to)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1324, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
)
&& fcode == INTEGER_TYPE)
1325 {
1326 /* For backwards brain damage compatibility, allow interconversion of
1327 enums and integers with a pedwarn. */
1328 conv = build_conv (ck_std, to, conv);
1329 conv->bad_p = true;
1330 }
1331 else if ((tcode == POINTER_TYPE && fcode == POINTER_TYPE)
1332 || (TYPE_PTRDATAMEM_P (to)(((enum tree_code) (to)->base.code) == OFFSET_TYPE) && TYPE_PTRDATAMEM_P (from)(((enum tree_code) (from)->base.code) == OFFSET_TYPE)))
1333 {
1334 tree to_pointee;
1335 tree from_pointee;
1336
1337 if (tcode == POINTER_TYPE)
1338 {
1339 to_pointee = TREE_TYPE (to)((contains_struct_check ((to), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1339, __FUNCTION__))->typed.type)
;
1340 from_pointee = TREE_TYPE (from)((contains_struct_check ((from), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1340, __FUNCTION__))->typed.type)
;
1341
1342 /* Since this is the target of a pointer, it can't have function
1343 qualifiers, so any TYPE_QUALS must be for attributes const or
1344 noreturn. Strip them. */
1345 if (TREE_CODE (to_pointee)((enum tree_code) (to_pointee)->base.code) == FUNCTION_TYPE
1346 && TYPE_QUALS (to_pointee)((int) ((((tree_class_check ((to_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1346, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST
) | (((tree_class_check ((to_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1346, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE
) | (((tree_class_check ((to_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1346, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC
) | (((tree_class_check ((to_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1346, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT
) | (((((tree_class_check ((to_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1346, __FUNCTION__))->base.u.bits.address_space) & 0xFF
) << 8))))
)
1347 to_pointee = build_qualified_type (to_pointee, TYPE_UNQUALIFIED);
1348 if (TREE_CODE (from_pointee)((enum tree_code) (from_pointee)->base.code) == FUNCTION_TYPE
1349 && TYPE_QUALS (from_pointee)((int) ((((tree_class_check ((from_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1349, __FUNCTION__))->base.readonly_flag) * TYPE_QUAL_CONST
) | (((tree_class_check ((from_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1349, __FUNCTION__))->base.volatile_flag) * TYPE_QUAL_VOLATILE
) | (((tree_class_check ((from_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1349, __FUNCTION__))->base.u.bits.atomic_flag) * TYPE_QUAL_ATOMIC
) | (((tree_class_check ((from_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1349, __FUNCTION__))->type_common.restrict_flag) * TYPE_QUAL_RESTRICT
) | (((((tree_class_check ((from_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1349, __FUNCTION__))->base.u.bits.address_space) & 0xFF
) << 8))))
)
1350 from_pointee = build_qualified_type (from_pointee, TYPE_UNQUALIFIED);
1351 }
1352 else
1353 {
1354 to_pointee = TYPE_PTRMEM_POINTED_TO_TYPE (to)((((enum tree_code) (to)->base.code) == OFFSET_TYPE) ? ((contains_struct_check
((to), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1354, __FUNCTION__))->typed.type) : ((contains_struct_check
(((cp_build_qualified_type_real ((((contains_struct_check ((
((tree_check3 ((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1354, __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/call.c"
, 1354, __FUNCTION__))->typed.type)), (cp_type_quals (to))
, tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1354, __FUNCTION__))->typed.type))
;
1355 from_pointee = TYPE_PTRMEM_POINTED_TO_TYPE (from)((((enum tree_code) (from)->base.code) == OFFSET_TYPE) ? (
(contains_struct_check ((from), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1355, __FUNCTION__))->typed.type) : ((contains_struct_check
(((cp_build_qualified_type_real ((((contains_struct_check ((
((tree_check3 ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1355, __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/call.c"
, 1355, __FUNCTION__))->typed.type)), (cp_type_quals (from
)), tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1355, __FUNCTION__))->typed.type))
;
1356 }
1357
1358 if (tcode == POINTER_TYPE
1359 && same_type_ignoring_top_level_qualifiers_p (from_pointee,
1360 to_pointee))
1361 ;
1362 else if (VOID_TYPE_P (to_pointee)(((enum tree_code) (to_pointee)->base.code) == VOID_TYPE)
1363 && !TYPE_PTRDATAMEM_P (from)(((enum tree_code) (from)->base.code) == OFFSET_TYPE)
1364 && TREE_CODE (from_pointee)((enum tree_code) (from_pointee)->base.code) != FUNCTION_TYPE)
1365 {
1366 tree nfrom = TREE_TYPE (from)((contains_struct_check ((from), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1366, __FUNCTION__))->typed.type)
;
1367 /* Don't try to apply restrict to void. */
1368 int quals = cp_type_quals (nfrom) & ~TYPE_QUAL_RESTRICT;
1369 from_pointee = cp_build_qualified_type (void_type_node, quals)cp_build_qualified_type_real ((global_trees[TI_VOID_TYPE]), (
quals), tf_warning_or_error)
;
1370 from = build_pointer_type (from_pointee);
1371 conv = build_conv (ck_ptr, from, conv);
1372 }
1373 else if (TYPE_PTRDATAMEM_P (from)(((enum tree_code) (from)->base.code) == OFFSET_TYPE))
1374 {
1375 tree fbase = TYPE_PTRMEM_CLASS_TYPE (from)((((enum tree_code) (from)->base.code) == OFFSET_TYPE) ? (
(tree_check ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1375, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real
((((contains_struct_check ((((tree_check3 ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1375, __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/call.c"
, 1375, __FUNCTION__))->typed.type)), (cp_type_quals (from
)), tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1375, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1375, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))
;
1376 tree tbase = TYPE_PTRMEM_CLASS_TYPE (to)((((enum tree_code) (to)->base.code) == OFFSET_TYPE) ? ((tree_check
((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1376, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real
((((contains_struct_check ((((tree_check3 ((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1376, __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/call.c"
, 1376, __FUNCTION__))->typed.type)), (cp_type_quals (to))
, tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1376, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1376, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))
;
1377
1378 if (same_type_p (fbase, tbase)comptypes ((fbase), (tbase), 0))
1379 /* No base conversion needed. */;
1380 else if (DERIVED_FROM_P (fbase, tbase)(lookup_base ((tbase), (fbase), ba_any, __null, tf_none) != (
tree) __null)
1381 && (same_type_ignoring_top_level_qualifiers_p
1382 (from_pointee, to_pointee)))
1383 {
1384 from = build_ptrmem_type (tbase, from_pointee);
1385 conv = build_conv (ck_pmem, from, conv);
1386 }
1387 else
1388 return NULL__null;
1389 }
1390 else if (CLASS_TYPE_P (from_pointee)(((((enum tree_code) (from_pointee)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (from_pointee)->base.code)) == UNION_TYPE
) && ((tree_class_check ((from_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1390, __FUNCTION__))->type_common.lang_flag_5))
1391 && CLASS_TYPE_P (to_pointee)(((((enum tree_code) (to_pointee)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (to_pointee)->base.code)) == UNION_TYPE
) && ((tree_class_check ((to_pointee), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1391, __FUNCTION__))->type_common.lang_flag_5))
1392 /* [conv.ptr]
1393
1394 An rvalue of type "pointer to cv D," where D is a
1395 class type, can be converted to an rvalue of type
1396 "pointer to cv B," where B is a base class (clause
1397 _class.derived_) of D. If B is an inaccessible
1398 (clause _class.access_) or ambiguous
1399 (_class.member.lookup_) base class of D, a program
1400 that necessitates this conversion is ill-formed.
1401 Therefore, we use DERIVED_FROM_P, and do not check
1402 access or uniqueness. */
1403 && DERIVED_FROM_P (to_pointee, from_pointee)(lookup_base ((from_pointee), (to_pointee), ba_any, __null, tf_none
) != (tree) __null)
)
1404 {
1405 from_pointee
1406 = cp_build_qualified_type (to_pointee,cp_build_qualified_type_real ((to_pointee), (cp_type_quals (from_pointee
)), tf_warning_or_error)
1407 cp_type_quals (from_pointee))cp_build_qualified_type_real ((to_pointee), (cp_type_quals (from_pointee
)), tf_warning_or_error)
;
1408 from = build_pointer_type (from_pointee);
1409 conv = build_conv (ck_ptr, from, conv);
1410 conv->base_p = true;
1411 }
1412
1413 if (same_type_p (from, to)comptypes ((from), (to), 0))
1414 /* OK */;
1415 else if (c_cast_p && comp_ptr_ttypes_const (to, from, bounds_either))
1416 /* In a C-style cast, we ignore CV-qualification because we
1417 are allowed to perform a static_cast followed by a
1418 const_cast. */
1419 conv = build_conv (ck_qual, to, conv);
1420 else if (!c_cast_p && comp_ptr_ttypes (to_pointee, from_pointee))
1421 conv = build_conv (ck_qual, to, conv);
1422 else if (expr && string_conv_p (to, expr, 0))
1423 /* converting from string constant to char *. */
1424 conv = build_conv (ck_qual, to, conv);
1425 else if (fnptr_conv_p (to, from))
1426 conv = build_conv (ck_fnptr, to, conv);
1427 /* Allow conversions among compatible ObjC pointer types (base
1428 conversions have been already handled above). */
1429 else if (c_dialect_objc ()((c_language & clk_objc) != 0)
1430 && objc_compare_types (to, from, -4, NULL_TREE(tree) __null))
1431 conv = build_conv (ck_ptr, to, conv);
1432 else if (ptr_reasonably_similar (to_pointee, from_pointee))
1433 {
1434 conv = build_conv (ck_ptr, to, conv);
1435 conv->bad_p = true;
1436 }
1437 else
1438 return NULL__null;
1439
1440 from = to;
1441 }
1442 else if (TYPE_PTRMEMFUNC_P (to)(((enum tree_code) (to)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1442, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1442, __FUNCTION__))->type_common.lang_flag_2)))
&& TYPE_PTRMEMFUNC_P (from)(((enum tree_code) (from)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1442, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1442, __FUNCTION__))->type_common.lang_flag_2)))
)
1443 {
1444 tree fromfn = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (from))((contains_struct_check (((cp_build_qualified_type_real ((((contains_struct_check
((((tree_check3 ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1444, __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/call.c"
, 1444, __FUNCTION__))->typed.type)), (cp_type_quals (from
)), tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1444, __FUNCTION__))->typed.type)
;
1445 tree tofn = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (to))((contains_struct_check (((cp_build_qualified_type_real ((((contains_struct_check
((((tree_check3 ((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1445, __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/call.c"
, 1445, __FUNCTION__))->typed.type)), (cp_type_quals (to))
, tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1445, __FUNCTION__))->typed.type)
;
1446 tree fbase = class_of_this_parm (fromfn);
1447 tree tbase = class_of_this_parm (tofn);
1448
1449 /* If FBASE and TBASE are equivalent but incomplete, DERIVED_FROM_P
1450 yields false. But a pointer to member of incomplete class is OK. */
1451 if (!same_type_p (fbase, tbase)comptypes ((fbase), (tbase), 0) && !DERIVED_FROM_P (fbase, tbase)(lookup_base ((tbase), (fbase), ba_any, __null, tf_none) != (
tree) __null)
)
1452 return NULL__null;
1453
1454 tree fstat = static_fn_type (fromfn);
1455 tree tstat = static_fn_type (tofn);
1456 if (same_type_p (tstat, fstat)comptypes ((tstat), (fstat), 0)
1457 || fnptr_conv_p (tstat, fstat))
1458 /* OK */;
1459 else
1460 return NULL__null;
1461
1462 if (!same_type_p (fbase, tbase)comptypes ((fbase), (tbase), 0))
1463 {
1464 from = build_memfn_type (fstat,
1465 tbase,
1466 cp_type_quals (tbase),
1467 type_memfn_rqual (tofn));
1468 from = build_ptrmemfunc_type (build_pointer_type (from));
1469 conv = build_conv (ck_pmem, from, conv);
1470 conv->base_p = true;
1471 }
1472 if (fnptr_conv_p (tstat, fstat))
1473 conv = build_conv (ck_fnptr, to, conv);
1474 }
1475 else if (tcode == BOOLEAN_TYPE)
1476 {
1477 /* [conv.bool]
1478
1479 A prvalue of arithmetic, unscoped enumeration, pointer, or pointer
1480 to member type can be converted to a prvalue of type bool. ...
1481 For direct-initialization (8.5 [dcl.init]), a prvalue of type
1482 std::nullptr_t can be converted to a prvalue of type bool; */
1483 if (ARITHMETIC_TYPE_P (from)((((enum tree_code) (from)->base.code) == BOOLEAN_TYPE || (
(enum tree_code) (from)->base.code) == INTEGER_TYPE) || ((
enum tree_code) (from)->base.code) == REAL_TYPE || ((enum tree_code
) (from)->base.code) == COMPLEX_TYPE)
1484 || UNSCOPED_ENUM_P (from)(((enum tree_code) (from)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1484, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
)
1485 || fcode == POINTER_TYPE
1486 || TYPE_PTRMEM_P (from)((((enum tree_code) (from)->base.code) == OFFSET_TYPE) || (
((enum tree_code) (from)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1486, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1486, __FUNCTION__))->type_common.lang_flag_2))))
1487 || NULLPTR_TYPE_P (from)(((enum tree_code) (from)->base.code) == NULLPTR_TYPE))
1488 {
1489 conv = build_conv (ck_std, to, conv);
1490 if (fcode == POINTER_TYPE
1491 || TYPE_PTRDATAMEM_P (from)(((enum tree_code) (from)->base.code) == OFFSET_TYPE)
1492 || (TYPE_PTRMEMFUNC_P (from)(((enum tree_code) (from)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1492, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1492, __FUNCTION__))->type_common.lang_flag_2)))
1493 && conv->rank < cr_pbool)
1494 || NULLPTR_TYPE_P (from)(((enum tree_code) (from)->base.code) == NULLPTR_TYPE))
1495 conv->rank = cr_pbool;
1496 if (NULLPTR_TYPE_P (from)(((enum tree_code) (from)->base.code) == NULLPTR_TYPE) && (flags & LOOKUP_ONLYCONVERTING(1 << 2)))
1497 conv->bad_p = true;
1498 if (flags & LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1))
1499 conv->check_narrowing = true;
1500 return conv;
1501 }
1502
1503 return NULL__null;
1504 }
1505 /* We don't check for ENUMERAL_TYPE here because there are no standard
1506 conversions to enum type. */
1507 /* As an extension, allow conversion to complex type. */
1508 else if (ARITHMETIC_TYPE_P (to)((((enum tree_code) (to)->base.code) == BOOLEAN_TYPE || ((
enum tree_code) (to)->base.code) == INTEGER_TYPE) || ((enum
tree_code) (to)->base.code) == REAL_TYPE || ((enum tree_code
) (to)->base.code) == COMPLEX_TYPE)
)
1509 {
1510 if (! (INTEGRAL_CODE_P (fcode)((fcode) == ENUMERAL_TYPE || (fcode) == BOOLEAN_TYPE || (fcode
) == INTEGER_TYPE)
1511 || (fcode == REAL_TYPE && !(flags & LOOKUP_NO_NON_INTEGRAL(((((((((((1 << 6) << 1) << 1) << 1) <<
1) << 1) << 1) << 1) << 1) << 1
) << 1)
)))
1512 || SCOPED_ENUM_P (from)(((enum tree_code) (from)->base.code) == ENUMERAL_TYPE &&
((tree_check ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1512, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
)
)
1513 return NULL__null;
1514
1515 /* If we're parsing an enum with no fixed underlying type, we're
1516 dealing with an incomplete type, which renders the conversion
1517 ill-formed. */
1518 if (!COMPLETE_TYPE_P (from)(((tree_class_check ((from), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1518, __FUNCTION__))->type_common.size) != (tree) __null
)
)
1519 return NULL__null;
1520
1521 conv = build_conv (ck_std, to, conv);
1522
1523 tree underlying_type = NULL_TREE(tree) __null;
1524 if (TREE_CODE (from)((enum tree_code) (from)->base.code) == ENUMERAL_TYPE
1525 && ENUM_FIXED_UNDERLYING_TYPE_P (from)(((tree_class_check ((from), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1525, __FUNCTION__))->type_common.lang_flag_5))
)
1526 underlying_type = ENUM_UNDERLYING_TYPE (from)((contains_struct_check (((tree_check ((from), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1526, __FUNCTION__, (ENUMERAL_TYPE)))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1526, __FUNCTION__))->typed.type)
;
1527
1528 /* Give this a better rank if it's a promotion.
1529
1530 To handle CWG 1601, also bump the rank if we are converting
1531 an enumeration with a fixed underlying type to the underlying
1532 type. */
1533 if ((same_type_p (to, type_promotes_to (from))comptypes ((to), (type_promotes_to (from)), 0)
1534 || (underlying_type && same_type_p (to, underlying_type)comptypes ((to), (underlying_type), 0)))
1535 && next_conversion (conv)->rank <= cr_promotion)
1536 conv->rank = cr_promotion;
1537 }
1538 else if (fcode == VECTOR_TYPE && tcode == VECTOR_TYPE
1539 && vector_types_convertible_p (from, to, false))
1540 return build_conv (ck_std, to, conv);
1541 else if (MAYBE_CLASS_TYPE_P (to)((((enum tree_code) (to)->base.code) == TEMPLATE_TYPE_PARM
|| ((enum tree_code) (to)->base.code) == TYPENAME_TYPE ||
((enum tree_code) (to)->base.code) == TYPEOF_TYPE || ((enum
tree_code) (to)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (to)->base.code) == DECLTYPE_TYPE) ||
(((((enum tree_code) (to)->base.code)) == RECORD_TYPE || (
((enum tree_code) (to)->base.code)) == UNION_TYPE) &&
((tree_class_check ((to), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1541, __FUNCTION__))->type_common.lang_flag_5)))
&& MAYBE_CLASS_TYPE_P (from)((((enum tree_code) (from)->base.code) == TEMPLATE_TYPE_PARM
|| ((enum tree_code) (from)->base.code) == TYPENAME_TYPE ||
((enum tree_code) (from)->base.code) == TYPEOF_TYPE || ((
enum tree_code) (from)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (from)->base.code) == DECLTYPE_TYPE)
|| (((((enum tree_code) (from)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (from)->base.code)) == UNION_TYPE) &&
((tree_class_check ((from), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1541, __FUNCTION__))->type_common.lang_flag_5)))
1542 && is_properly_derived_from (from, to))
1543 {
1544 if (conv->kind == ck_rvalue)
1545 conv = next_conversion (conv);
1546 conv = build_conv (ck_base, to, conv);
1547 /* The derived-to-base conversion indicates the initialization
1548 of a parameter with base type from an object of a derived
1549 type. A temporary object is created to hold the result of
1550 the conversion unless we're binding directly to a reference. */
1551 conv->need_temporary_p = !(flags & LOOKUP_NO_TEMP_BIND(1 << 6));
1552 if (flags & LOOKUP_PREFER_RVALUE((1 << 6) << 1))
1553 /* Tell convert_like to set LOOKUP_PREFER_RVALUE. */
1554 conv->rvaluedness_matches_p = true;
1555 /* If we're performing copy-initialization, remember to skip
1556 explicit constructors. */
1557 if (flags & LOOKUP_ONLYCONVERTING(1 << 2))
1558 conv->copy_init_p = true;
1559 }
1560 else
1561 return NULL__null;
1562
1563 if (flags & LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1))
1564 conv->check_narrowing = true;
1565
1566 return conv;
1567}
1568
1569/* Returns nonzero if T1 is reference-related to T2. */
1570
1571bool
1572reference_related_p (tree t1, tree t2)
1573{
1574 if (t1 == error_mark_nodeglobal_trees[TI_ERROR_MARK] || t2 == error_mark_nodeglobal_trees[TI_ERROR_MARK])
1575 return false;
1576
1577 t1 = TYPE_MAIN_VARIANT (t1)((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1577, __FUNCTION__))->type_common.main_variant)
;
1578 t2 = TYPE_MAIN_VARIANT (t2)((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1578, __FUNCTION__))->type_common.main_variant)
;
1579
1580 /* [dcl.init.ref]
1581
1582 Given types "cv1 T1" and "cv2 T2," "cv1 T1" is reference-related
1583 to "cv2 T2" if T1 is similar to T2, or T1 is a base class of T2. */
1584 return (similar_type_p (t1, t2)
1585 || (CLASS_TYPE_P (t1)(((((enum tree_code) (t1)->base.code)) == RECORD_TYPE || (
((enum tree_code) (t1)->base.code)) == UNION_TYPE) &&
((tree_class_check ((t1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1585, __FUNCTION__))->type_common.lang_flag_5))
&& CLASS_TYPE_P (t2)(((((enum tree_code) (t2)->base.code)) == RECORD_TYPE || (
((enum tree_code) (t2)->base.code)) == UNION_TYPE) &&
((tree_class_check ((t2), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1585, __FUNCTION__))->type_common.lang_flag_5))
1586 && DERIVED_FROM_P (t1, t2)(lookup_base ((t2), (t1), ba_any, __null, tf_none) != (tree) __null
)
));
1587}
1588
1589/* Returns nonzero if T1 is reference-compatible with T2. */
1590
1591bool
1592reference_compatible_p (tree t1, tree t2)
1593{
1594 /* [dcl.init.ref]
1595
1596 "cv1 T1" is reference compatible with "cv2 T2" if
1597 a prvalue of type "pointer to cv2 T2" can be converted to the type
1598 "pointer to cv1 T1" via a standard conversion sequence. */
1599 tree ptype1 = build_pointer_type (t1);
1600 tree ptype2 = build_pointer_type (t2);
1601 conversion *conv = standard_conversion (ptype1, ptype2, NULL_TREE(tree) __null,
1602 /*c_cast_p=*/false, 0, tf_none);
1603 if (!conv || conv->bad_p)
1604 return false;
1605 return true;
1606}
1607
1608/* Return true if converting FROM to TO would involve a qualification
1609 conversion. */
1610
1611static bool
1612involves_qualification_conversion_p (tree to, tree from)
1613{
1614 /* If we're not convering a pointer to another one, we won't get
1615 a qualification conversion. */
1616 if (!((TYPE_PTR_P (to)(((enum tree_code) (to)->base.code) == POINTER_TYPE) && TYPE_PTR_P (from)(((enum tree_code) (from)->base.code) == POINTER_TYPE))
1617 || (TYPE_PTRDATAMEM_P (to)(((enum tree_code) (to)->base.code) == OFFSET_TYPE) && TYPE_PTRDATAMEM_P (from)(((enum tree_code) (from)->base.code) == OFFSET_TYPE))))
1618 return false;
1619
1620 conversion *conv = standard_conversion (to, from, NULL_TREE(tree) __null,
1621 /*c_cast_p=*/false, 0, tf_none);
1622 for (conversion *t = conv; t; t = next_conversion (t))
1623 if (t->kind == ck_qual)
1624 return true;
1625
1626 return false;
1627}
1628
1629/* A reference of the indicated TYPE is being bound directly to the
1630 expression represented by the implicit conversion sequence CONV.
1631 Return a conversion sequence for this binding. */
1632
1633static conversion *
1634direct_reference_binding (tree type, conversion *conv)
1635{
1636 tree t;
1637
1638 gcc_assert (TYPE_REF_P (type))((void)(!((((enum tree_code) (type)->base.code) == REFERENCE_TYPE
)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1638, __FUNCTION__), 0 : 0))
;
1639 gcc_assert (!TYPE_REF_P (conv->type))((void)(!(!(((enum tree_code) (conv->type)->base.code) ==
REFERENCE_TYPE)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1639, __FUNCTION__), 0 : 0))
;
1640
1641 t = TREE_TYPE (type)((contains_struct_check ((type), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1641, __FUNCTION__))->typed.type)
;
1642
1643 if (conv->kind == ck_identity)
1644 /* Mark the identity conv as to not decay to rvalue. */
1645 conv->rvaluedness_matches_p = true;
1646
1647 /* [over.ics.rank]
1648
1649 When a parameter of reference type binds directly
1650 (_dcl.init.ref_) to an argument expression, the implicit
1651 conversion sequence is the identity conversion, unless the
1652 argument expression has a type that is a derived class of the
1653 parameter type, in which case the implicit conversion sequence is
1654 a derived-to-base Conversion.
1655
1656 If the parameter binds directly to the result of applying a
1657 conversion function to the argument expression, the implicit
1658 conversion sequence is a user-defined conversion sequence
1659 (_over.ics.user_), with the second standard conversion sequence
1660 either an identity conversion or, if the conversion function
1661 returns an entity of a type that is a derived class of the
1662 parameter type, a derived-to-base conversion. */
1663 if (is_properly_derived_from (conv->type, t))
1664 {
1665 /* Represent the derived-to-base conversion. */
1666 conv = build_conv (ck_base, t, conv);
1667 /* We will actually be binding to the base-class subobject in
1668 the derived class, so we mark this conversion appropriately.
1669 That way, convert_like knows not to generate a temporary. */
1670 conv->need_temporary_p = false;
1671 }
1672 else if (involves_qualification_conversion_p (t, conv->type))
1673 /* Represent the qualification conversion. After DR 2352
1674 #1 and #2 were indistinguishable conversion sequences:
1675
1676 void f(int*); // #1
1677 void f(const int* const &); // #2
1678 void g(int* p) { f(p); }
1679
1680 because the types "int *" and "const int *const" are
1681 reference-related and we were binding both directly and they
1682 had the same rank. To break it up, we add a ck_qual under the
1683 ck_ref_bind so that conversion sequence ranking chooses #1. */
1684 conv = build_conv (ck_qual, t, conv);
1685
1686 return build_conv (ck_ref_bind, type, conv);
1687}
1688
1689/* Returns the conversion path from type FROM to reference type TO for
1690 purposes of reference binding. For lvalue binding, either pass a
1691 reference type to FROM or an lvalue expression to EXPR. If the
1692 reference will be bound to a temporary, NEED_TEMPORARY_P is set for
1693 the conversion returned. If C_CAST_P is true, this
1694 conversion is coming from a C-style cast. */
1695
1696static conversion *
1697reference_binding (tree rto, tree rfrom, tree expr, bool c_cast_p, int flags,
1698 tsubst_flags_t complain)
1699{
1700 conversion *conv = NULL__null;
1701 tree to = TREE_TYPE (rto)((contains_struct_check ((rto), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1701, __FUNCTION__))->typed.type)
;
1702 tree from = rfrom;
1703 tree tfrom;
1704 bool related_p;
1705 bool compatible_p;
1706 cp_lvalue_kind gl_kind;
1707 bool is_lvalue;
1708
1709 if (TREE_CODE (to)((enum tree_code) (to)->base.code) == FUNCTION_TYPE && expr && type_unknown_p (expr))
1710 {
1711 expr = instantiate_type (to, expr, tf_none);
1712 if (expr == error_mark_nodeglobal_trees[TI_ERROR_MARK])
1713 return NULL__null;
1714 from = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1714, __FUNCTION__))->typed.type)
;
1715 }
1716
1717 bool copy_list_init = false;
1718 if (expr && BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1718, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
1719 {
1720 maybe_warn_cpp0x (CPP0X_INITIALIZER_LISTS);
1721 /* DR 1288: Otherwise, if the initializer list has a single element
1722 of type E and ... [T's] referenced type is reference-related to E,
1723 the object or reference is initialized from that element...
1724
1725 ??? With P0388R4, we should bind 't' directly to U{}:
1726 using U = A[2];
1727 A (&&t)[] = {U{}};
1728 because A[] and A[2] are reference-related. But we don't do it
1729 because grok_reference_init has deduced the array size (to 1), and
1730 A[1] and A[2] aren't reference-related. */
1731 if (CONSTRUCTOR_NELTS (expr)(vec_safe_length (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1731, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
== 1
1732 && !CONSTRUCTOR_IS_DESIGNATED_INIT (expr)(((tree_not_check2 (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1732, __FUNCTION__, (CONSTRUCTOR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1732, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_6))
)
1733 {
1734 tree elt = CONSTRUCTOR_ELT (expr, 0)(&(*((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1734, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
0])
->value;
1735 if (error_operand_p (elt))
1736 return NULL__null;
1737 tree etype = TREE_TYPE (elt)((contains_struct_check ((elt), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1737, __FUNCTION__))->typed.type)
;
1738 if (reference_related_p (to, etype))
1739 {
1740 expr = elt;
1741 from = etype;
1742 goto skip;
1743 }
1744 }
1745 /* Otherwise, if T is a reference type, a prvalue temporary of the type
1746 referenced by T is copy-list-initialized, and the reference is bound
1747 to that temporary. */
1748 copy_list_init = true;
1749 skip:;
1750 }
1751
1752 if (TYPE_REF_P (from)(((enum tree_code) (from)->base.code) == REFERENCE_TYPE))
1753 {
1754 from = TREE_TYPE (from)((contains_struct_check ((from), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1754, __FUNCTION__))->typed.type)
;
1755 if (!TYPE_REF_IS_RVALUE (rfrom)((tree_check ((rfrom), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1755, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
1756 || TREE_CODE (from)((enum tree_code) (from)->base.code) == FUNCTION_TYPE)
1757 gl_kind = clk_ordinary;
1758 else
1759 gl_kind = clk_rvalueref;
1760 }
1761 else if (expr)
1762 gl_kind = lvalue_kind (expr);
1763 else if (CLASS_TYPE_P (from)(((((enum tree_code) (from)->base.code)) == RECORD_TYPE ||
(((enum tree_code) (from)->base.code)) == UNION_TYPE) &&
((tree_class_check ((from), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1763, __FUNCTION__))->type_common.lang_flag_5))
1764 || TREE_CODE (from)((enum tree_code) (from)->base.code) == ARRAY_TYPE)
1765 gl_kind = clk_class;
1766 else
1767 gl_kind = clk_none;
1768
1769 /* Don't allow a class prvalue when LOOKUP_NO_TEMP_BIND. */
1770 if ((flags & LOOKUP_NO_TEMP_BIND(1 << 6))
1771 && (gl_kind & clk_class))
1772 gl_kind = clk_none;
1773
1774 /* Same mask as real_lvalue_p. */
1775 is_lvalue = gl_kind && !(gl_kind & (clk_rvalueref|clk_class));
1776
1777 tfrom = from;
1778 if ((gl_kind & clk_bitfield) != 0)
1779 tfrom = unlowered_expr_type (expr);
1780
1781 /* Figure out whether or not the types are reference-related and
1782 reference compatible. We have to do this after stripping
1783 references from FROM. */
1784 related_p = reference_related_p (to, tfrom);
1785 /* If this is a C cast, first convert to an appropriately qualified
1786 type, so that we can later do a const_cast to the desired type. */
1787 if (related_p && c_cast_p
1788 && !at_least_as_qualified_p (to, tfrom))
1789 to = cp_build_qualified_type (to, cp_type_quals (tfrom))cp_build_qualified_type_real ((to), (cp_type_quals (tfrom)), tf_warning_or_error
)
;
1790 compatible_p = reference_compatible_p (to, tfrom);
1791
1792 /* Directly bind reference when target expression's type is compatible with
1793 the reference and expression is an lvalue. In DR391, the wording in
1794 [8.5.3/5 dcl.init.ref] is changed to also require direct bindings for
1795 const and rvalue references to rvalues of compatible class type.
1796 We should also do direct bindings for non-class xvalues. */
1797 if ((related_p || compatible_p) && gl_kind)
1798 {
1799 /* [dcl.init.ref]
1800
1801 If the initializer expression
1802
1803 -- is an lvalue (but not an lvalue for a bit-field), and "cv1 T1"
1804 is reference-compatible with "cv2 T2,"
1805
1806 the reference is bound directly to the initializer expression
1807 lvalue.
1808
1809 [...]
1810 If the initializer expression is an rvalue, with T2 a class type,
1811 and "cv1 T1" is reference-compatible with "cv2 T2", the reference
1812 is bound to the object represented by the rvalue or to a sub-object
1813 within that object. */
1814
1815 conv = build_identity_conv (tfrom, expr);
1816 conv = direct_reference_binding (rto, conv);
1817
1818 if (TYPE_REF_P (rfrom)(((enum tree_code) (rfrom)->base.code) == REFERENCE_TYPE))
1819 /* Handle rvalue reference to function properly. */
1820 conv->rvaluedness_matches_p
1821 = (TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1821, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
== TYPE_REF_IS_RVALUE (rfrom)((tree_check ((rfrom), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1821, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
);
1822 else
1823 conv->rvaluedness_matches_p
1824 = (TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1824, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
== !is_lvalue);
1825
1826 if ((gl_kind & clk_bitfield) != 0
1827 || ((gl_kind & clk_packed) != 0 && !TYPE_PACKED (to)((tree_class_check ((to), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1827, __FUNCTION__))->base.u.bits.packed_flag)
))
1828 /* For the purposes of overload resolution, we ignore the fact
1829 this expression is a bitfield or packed field. (In particular,
1830 [over.ics.ref] says specifically that a function with a
1831 non-const reference parameter is viable even if the
1832 argument is a bitfield.)
1833
1834 However, when we actually call the function we must create
1835 a temporary to which to bind the reference. If the
1836 reference is volatile, or isn't const, then we cannot make
1837 a temporary, so we just issue an error when the conversion
1838 actually occurs. */
1839 conv->need_temporary_p = true;
1840
1841 /* Don't allow binding of lvalues (other than function lvalues) to
1842 rvalue references. */
1843 if (is_lvalue && TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1843, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
1844 && TREE_CODE (to)((enum tree_code) (to)->base.code) != FUNCTION_TYPE)
1845 conv->bad_p = true;
1846
1847 /* Nor the reverse. */
1848 if (!is_lvalue && !TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1848, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
1849 /* Unless it's really an lvalue. */
1850 && !(cxx_dialect >= cxx20
1851 && (gl_kind & clk_implicit_rval))
1852 && (!CP_TYPE_CONST_NON_VOLATILE_P (to)((cp_type_quals (to) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE
)) == TYPE_QUAL_CONST)
1853 || (flags & LOOKUP_NO_RVAL_BIND((((((((((1 << 6) << 1) << 1) << 1) <<
1) << 1) << 1) << 1) << 1) << 1
)
))
1854 && TREE_CODE (to)((enum tree_code) (to)->base.code) != FUNCTION_TYPE)
1855 conv->bad_p = true;
1856
1857 if (!compatible_p)
1858 conv->bad_p = true;
1859
1860 return conv;
1861 }
1862 /* [class.conv.fct] A conversion function is never used to convert a
1863 (possibly cv-qualified) object to the (possibly cv-qualified) same
1864 object type (or a reference to it), to a (possibly cv-qualified) base
1865 class of that type (or a reference to it).... */
1866 else if (CLASS_TYPE_P (from)(((((enum tree_code) (from)->base.code)) == RECORD_TYPE ||
(((enum tree_code) (from)->base.code)) == UNION_TYPE) &&
((tree_class_check ((from), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1866, __FUNCTION__))->type_common.lang_flag_5))
&& !related_p
1867 && !(flags & LOOKUP_NO_CONVERSION(1 << 4)))
1868 {
1869 /* [dcl.init.ref]
1870
1871 If the initializer expression
1872
1873 -- has a class type (i.e., T2 is a class type) can be
1874 implicitly converted to an lvalue of type "cv3 T3," where
1875 "cv1 T1" is reference-compatible with "cv3 T3". (this
1876 conversion is selected by enumerating the applicable
1877 conversion functions (_over.match.ref_) and choosing the
1878 best one through overload resolution. (_over.match_).
1879
1880 the reference is bound to the lvalue result of the conversion
1881 in the second case. */
1882 z_candidate *cand = build_user_type_conversion_1 (rto, expr, flags,
1883 complain);
1884 if (cand)
1885 return cand->second_conv;
1886 }
1887
1888 /* From this point on, we conceptually need temporaries, even if we
1889 elide them. Only the cases above are "direct bindings". */
1890 if (flags & LOOKUP_NO_TEMP_BIND(1 << 6))
1891 return NULL__null;
1892
1893 /* [over.ics.rank]
1894
1895 When a parameter of reference type is not bound directly to an
1896 argument expression, the conversion sequence is the one required
1897 to convert the argument expression to the underlying type of the
1898 reference according to _over.best.ics_. Conceptually, this
1899 conversion sequence corresponds to copy-initializing a temporary
1900 of the underlying type with the argument expression. Any
1901 difference in top-level cv-qualification is subsumed by the
1902 initialization itself and does not constitute a conversion. */
1903
1904 /* [dcl.init.ref]
1905
1906 Otherwise, the reference shall be an lvalue reference to a
1907 non-volatile const type, or the reference shall be an rvalue
1908 reference.
1909
1910 We try below to treat this as a bad conversion to improve diagnostics,
1911 but if TO is an incomplete class, we need to reject this conversion
1912 now to avoid unnecessary instantiation. */
1913 if (!CP_TYPE_CONST_NON_VOLATILE_P (to)((cp_type_quals (to) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE
)) == TYPE_QUAL_CONST)
&& !TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1913, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
1914 && !COMPLETE_TYPE_P (to)(((tree_class_check ((to), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1914, __FUNCTION__))->type_common.size) != (tree) __null
)
)
1915 return NULL__null;
1916
1917 /* We're generating a temporary now, but don't bind any more in the
1918 conversion (specifically, don't slice the temporary returned by a
1919 conversion operator). */
1920 flags |= LOOKUP_NO_TEMP_BIND(1 << 6);
1921
1922 /* Core issue 899: When [copy-]initializing a temporary to be bound
1923 to the first parameter of a copy constructor (12.8) called with
1924 a single argument in the context of direct-initialization,
1925 explicit conversion functions are also considered.
1926
1927 So don't set LOOKUP_ONLYCONVERTING in that case. */
1928 if (!(flags & LOOKUP_COPY_PARM(((((1 << 6) << 1) << 1) << 1) <<
1)
))
1929 flags |= LOOKUP_ONLYCONVERTING(1 << 2);
1930
1931 if (!conv)
1932 conv = implicit_conversion (to, from, expr, c_cast_p,
1933 flags, complain);
1934 if (!conv)
1935 return NULL__null;
1936
1937 if (conv->user_conv_p)
1938 {
1939 if (copy_list_init)
1940 /* Remember this was copy-list-initialization. */
1941 conv->need_temporary_p = true;
1942
1943 /* If initializing the temporary used a conversion function,
1944 recalculate the second conversion sequence. */
1945 for (conversion *t = conv; t; t = next_conversion (t))
1946 if (t->kind == ck_user
1947 && DECL_CONV_FN_P (t->cand->fn)((((tree_not_check2 (((tree_check ((((contains_struct_check (
(t->cand->fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1947, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1947, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1947, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)) & ((tree_not_check2 (((tree_check ((((contains_struct_check
((t->cand->fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1947, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1947, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1947, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_1) & (!((tree_not_check2 (((tree_check ((((contains_struct_check
((t->cand->fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1947, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1947, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1947, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0)))
)
1948 {
1949 tree ftype = TREE_TYPE (TREE_TYPE (t->cand->fn))((contains_struct_check ((((contains_struct_check ((t->cand
->fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1949, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1949, __FUNCTION__))->typed.type)
;
1950 /* A prvalue of non-class type is cv-unqualified. */
1951 if (!TYPE_REF_P (ftype)(((enum tree_code) (ftype)->base.code) == REFERENCE_TYPE) && !CLASS_TYPE_P (ftype)(((((enum tree_code) (ftype)->base.code)) == RECORD_TYPE ||
(((enum tree_code) (ftype)->base.code)) == UNION_TYPE) &&
((tree_class_check ((ftype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1951, __FUNCTION__))->type_common.lang_flag_5))
)
1952 ftype = cv_unqualified (ftype);
1953 int sflags = (flags|LOOKUP_NO_CONVERSION(1 << 4))&~LOOKUP_NO_TEMP_BIND(1 << 6);
1954 conversion *new_second
1955 = reference_binding (rto, ftype, NULL_TREE(tree) __null, c_cast_p,
1956 sflags, complain);
1957 if (!new_second)
1958 return NULL__null;
1959 return merge_conversion_sequences (t, new_second);
1960 }
1961 }
1962
1963 conv = build_conv (ck_ref_bind, rto, conv);
1964 /* This reference binding, unlike those above, requires the
1965 creation of a temporary. */
1966 conv->need_temporary_p = true;
1967 conv->rvaluedness_matches_p = TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1967, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
;
1968
1969 /* [dcl.init.ref]
1970
1971 Otherwise, the reference shall be an lvalue reference to a
1972 non-volatile const type, or the reference shall be an rvalue
1973 reference. */
1974 if (!CP_TYPE_CONST_NON_VOLATILE_P (to)((cp_type_quals (to) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE
)) == TYPE_QUAL_CONST)
&& !TYPE_REF_IS_RVALUE (rto)((tree_check ((rto), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 1974, __FUNCTION__, (REFERENCE_TYPE)))->base.private_flag
)
)
1975 conv->bad_p = true;
1976
1977 /* [dcl.init.ref]
1978
1979 Otherwise, a temporary of type "cv1 T1" is created and
1980 initialized from the initializer expression using the rules for a
1981 non-reference copy initialization. If T1 is reference-related to
1982 T2, cv1 must be the same cv-qualification as, or greater
1983 cv-qualification than, cv2; otherwise, the program is ill-formed. */
1984 if (related_p && !at_least_as_qualified_p (to, from))
1985 conv->bad_p = true;
1986
1987 return conv;
1988}
1989
1990/* Most of the implementation of implicit_conversion, with the same
1991 parameters. */
1992
1993static conversion *
1994implicit_conversion_1 (tree to, tree from, tree expr, bool c_cast_p,
1995 int flags, tsubst_flags_t complain)
1996{
1997 conversion *conv;
1998
1999 if (from == error_mark_nodeglobal_trees[TI_ERROR_MARK] || to == error_mark_nodeglobal_trees[TI_ERROR_MARK]
2000 || expr == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2001 return NULL__null;
2002
2003 /* Other flags only apply to the primary function in overload
2004 resolution, or after we've chosen one. */
2005 flags &= (LOOKUP_ONLYCONVERTING(1 << 2)|LOOKUP_NO_CONVERSION(1 << 4)|LOOKUP_COPY_PARM(((((1 << 6) << 1) << 1) << 1) <<
1)
2006 |LOOKUP_NO_TEMP_BIND(1 << 6)|LOOKUP_NO_RVAL_BIND((((((((((1 << 6) << 1) << 1) << 1) <<
1) << 1) << 1) << 1) << 1) << 1
)
|LOOKUP_PREFER_RVALUE((1 << 6) << 1)
2007 |LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1)|LOOKUP_PROTECT(1 << 0)|LOOKUP_NO_NON_INTEGRAL(((((((((((1 << 6) << 1) << 1) << 1) <<
1) << 1) << 1) << 1) << 1) << 1
) << 1)
);
2008
2009 /* FIXME: actually we don't want warnings either, but we can't just
2010 have 'complain &= ~(tf_warning|tf_error)' because it would cause
2011 the regression of, eg, g++.old-deja/g++.benjamin/16077.C.
2012 We really ought not to issue that warning until we've committed
2013 to that conversion. */
2014 complain &= ~tf_error;
2015
2016 /* Call reshape_init early to remove redundant braces. */
2017 if (expr && BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2017, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
2018 && CLASS_TYPE_P (to)(((((enum tree_code) (to)->base.code)) == RECORD_TYPE || (
((enum tree_code) (to)->base.code)) == UNION_TYPE) &&
((tree_class_check ((to), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2018, __FUNCTION__))->type_common.lang_flag_5))
2019 && COMPLETE_TYPE_P (complete_type (to))(((tree_class_check ((complete_type (to)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2019, __FUNCTION__))->type_common.size) != (tree) __null
)
2020 && !CLASSTYPE_NON_AGGREGATE (to)((((tree_class_check ((to), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2020, __FUNCTION__))->type_with_lang_specific.lang_specific
))->non_aggregate)
)
2021 {
2022 expr = reshape_init (to, expr, complain);
2023 if (expr == error_mark_nodeglobal_trees[TI_ERROR_MARK])
2024 return NULL__null;
2025 from = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2025, __FUNCTION__))->typed.type)
;
2026 }
2027
2028 if (TYPE_REF_P (to)(((enum tree_code) (to)->base.code) == REFERENCE_TYPE))
2029 conv = reference_binding (to, from, expr, c_cast_p, flags, complain);
2030 else
2031 conv = standard_conversion (to, from, expr, c_cast_p, flags, complain);
2032
2033 if (conv)
2034 return conv;
2035
2036 if (expr && BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2036, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
2037 {
2038 if (is_std_init_list (to) && !CONSTRUCTOR_IS_DESIGNATED_INIT (expr)(((tree_not_check2 (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2038, __FUNCTION__, (CONSTRUCTOR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2038, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_6))
)
2039 return build_list_conv (to, expr, flags, complain);
2040
2041 /* As an extension, allow list-initialization of _Complex. */
2042 if (TREE_CODE (to)((enum tree_code) (to)->base.code) == COMPLEX_TYPE
2043 && !CONSTRUCTOR_IS_DESIGNATED_INIT (expr)(((tree_not_check2 (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2043, __FUNCTION__, (CONSTRUCTOR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2043, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_6))
)
2044 {
2045 conv = build_complex_conv (to, expr, flags, complain);
2046 if (conv)
2047 return conv;
2048 }
2049
2050 /* Allow conversion from an initializer-list with one element to a
2051 scalar type. */
2052 if (SCALAR_TYPE_P (to)((((enum tree_code) (to)->base.code) == OFFSET_TYPE) || ((
enum tree_code) (to)->base.code) == ENUMERAL_TYPE || ((((enum
tree_code) (to)->base.code) == BOOLEAN_TYPE || ((enum tree_code
) (to)->base.code) == INTEGER_TYPE) || ((enum tree_code) (
to)->base.code) == REAL_TYPE || ((enum tree_code) (to)->
base.code) == COMPLEX_TYPE) || (((enum tree_code) (to)->base
.code) == POINTER_TYPE) || (((enum tree_code) (to)->base.code
) == RECORD_TYPE && (((tree_class_check (((tree_check
((to), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2052, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2052, __FUNCTION__))->type_common.lang_flag_2))) || (((enum
tree_code) (to)->base.code) == NULLPTR_TYPE))
)
2053 {
2054 int nelts = CONSTRUCTOR_NELTS (expr)(vec_safe_length (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2054, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
;
2055 tree elt;
2056
2057 if (nelts == 0)
2058 elt = build_value_init (to, tf_none);
2059 else if (nelts == 1 && !CONSTRUCTOR_IS_DESIGNATED_INIT (expr)(((tree_not_check2 (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2059, __FUNCTION__, (CONSTRUCTOR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2059, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_6))
)
2060 elt = CONSTRUCTOR_ELT (expr, 0)(&(*((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2060, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
0])
->value;
2061 else
2062 elt = error_mark_nodeglobal_trees[TI_ERROR_MARK];
2063
2064 conv = implicit_conversion (to, TREE_TYPE (elt)((contains_struct_check ((elt), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2064, __FUNCTION__))->typed.type)
, elt,
2065 c_cast_p, flags, complain);
2066 if (conv)
2067 {
2068 conv->check_narrowing = true;
2069 if (BRACE_ENCLOSED_INITIALIZER_P (elt)(((enum tree_code) (elt)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((elt), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2069, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
2070 /* Too many levels of braces, i.e. '{{1}}'. */
2071 conv->bad_p = true;
2072 return conv;
2073 }
2074 }
2075 else if (TREE_CODE (to)((enum tree_code) (to)->base.code) == ARRAY_TYPE)
2076 return build_array_conv (to, expr, flags, complain);
2077 }
2078
2079 if (expr != NULL_TREE(tree) __null
2080 && (MAYBE_CLASS_TYPE_P (from)((((enum tree_code) (from)->base.code) == TEMPLATE_TYPE_PARM
|| ((enum tree_code) (from)->base.code) == TYPENAME_TYPE ||
((enum tree_code) (from)->base.code) == TYPEOF_TYPE || ((
enum tree_code) (from)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (from)->base.code) == DECLTYPE_TYPE)
|| (((((enum tree_code) (from)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (from)->base.code)) == UNION_TYPE) &&
((tree_class_check ((from), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2080, __FUNCTION__))->type_common.lang_flag_5)))
2081 || MAYBE_CLASS_TYPE_P (to)((((enum tree_code) (to)->base.code) == TEMPLATE_TYPE_PARM
|| ((enum tree_code) (to)->base.code) == TYPENAME_TYPE ||
((enum tree_code) (to)->base.code) == TYPEOF_TYPE || ((enum
tree_code) (to)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (to)->base.code) == DECLTYPE_TYPE) ||
(((((enum tree_code) (to)->base.code)) == RECORD_TYPE || (
((enum tree_code) (to)->base.code)) == UNION_TYPE) &&
((tree_class_check ((to), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2081, __FUNCTION__))->type_common.lang_flag_5)))
)
2082 && (flags & LOOKUP_NO_CONVERSION(1 << 4)) == 0)
2083 {
2084 struct z_candidate *cand;
2085
2086 if (CLASS_TYPE_P (to)(((((enum tree_code) (to)->base.code)) == RECORD_TYPE || (
((enum tree_code) (to)->base.code)) == UNION_TYPE) &&
((tree_class_check ((to), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2086, __FUNCTION__))->type_common.lang_flag_5))
2087 && BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2087, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
2088 && !CLASSTYPE_NON_AGGREGATE (complete_type (to))((((tree_class_check ((complete_type (to)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2088, __FUNCTION__))->type_with_lang_specific.lang_specific
))->non_aggregate)
)
2089 return build_aggr_conv (to, expr, flags, complain);
2090
2091 cand = build_user_type_conversion_1 (to, expr, flags, complain);
2092 if (cand)
2093 {
2094 if (BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2094, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
2095 && CONSTRUCTOR_NELTS (expr)(vec_safe_length (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2095, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
== 1
2096 && !CONSTRUCTOR_IS_DESIGNATED_INIT (expr)(((tree_not_check2 (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2096, __FUNCTION__, (CONSTRUCTOR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2096, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_6))
2097 && !is_list_ctor (cand->fn))
2098 {
2099 /* "If C is not an initializer-list constructor and the
2100 initializer list has a single element of type cv U, where U is
2101 X or a class derived from X, the implicit conversion sequence
2102 has Exact Match rank if U is X, or Conversion rank if U is
2103 derived from X." */
2104 tree elt = CONSTRUCTOR_ELT (expr, 0)(&(*((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2104, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
0])
->value;
2105 tree elttype = TREE_TYPE (elt)((contains_struct_check ((elt), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2105, __FUNCTION__))->typed.type)
;
2106 if (reference_related_p (to, elttype))
2107 return implicit_conversion (to, elttype, elt,
2108 c_cast_p, flags, complain);
2109 }
2110 conv = cand->second_conv;
2111 }
2112
2113 /* We used to try to bind a reference to a temporary here, but that
2114 is now handled after the recursive call to this function at the end
2115 of reference_binding. */
2116 return conv;
2117 }
2118
2119 return NULL__null;
2120}
2121
2122/* Returns the implicit conversion sequence (see [over.ics]) from type
2123 FROM to type TO. The optional expression EXPR may affect the
2124 conversion. FLAGS are the usual overloading flags. If C_CAST_P is
2125 true, this conversion is coming from a C-style cast. */
2126
2127static conversion *
2128implicit_conversion (tree to, tree from, tree expr, bool c_cast_p,
2129 int flags, tsubst_flags_t complain)
2130{
2131 conversion *conv = implicit_conversion_1 (to, from, expr, c_cast_p,
2132 flags, complain);
2133 if (!conv || conv->bad_p)
2134 return conv;
2135 if (conv_is_prvalue (conv)
2136 && CLASS_TYPE_P (conv->type)(((((enum tree_code) (conv->type)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (conv->type)->base.code)) == UNION_TYPE
) && ((tree_class_check ((conv->type), (tcc_type),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2136, __FUNCTION__))->type_common.lang_flag_5))
2137 && CLASSTYPE_PURE_VIRTUALS (conv->type)((((tree_class_check ((conv->type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2137, __FUNCTION__))->type_with_lang_specific.lang_specific
))->pure_virtuals)
)
2138 conv->bad_p = true;
2139 return conv;
2140}
2141
2142/* Like implicit_conversion, but return NULL if the conversion is bad.
2143
2144 This is not static so that check_non_deducible_conversion can call it within
2145 add_template_candidate_real as part of overload resolution; it should not be
2146 called outside of overload resolution. */
2147
2148conversion *
2149good_conversion (tree to, tree from, tree expr,
2150 int flags, tsubst_flags_t complain)
2151{
2152 conversion *c = implicit_conversion (to, from, expr, /*cast*/false,
2153 flags, complain);
2154 if (c && c->bad_p)
2155 c = NULL__null;
2156 return c;
2157}
2158
2159/* Add a new entry to the list of candidates. Used by the add_*_candidate
2160 functions. ARGS will not be changed until a single candidate is
2161 selected. */
2162
2163static struct z_candidate *
2164add_candidate (struct z_candidate **candidates,
2165 tree fn, tree first_arg, const vec<tree, va_gc> *args,
2166 size_t num_convs, conversion **convs,
2167 tree access_path, tree conversion_path,
2168 int viable, struct rejection_reason *reason,
2169 int flags)
2170{
2171 struct z_candidate *cand = (struct z_candidate *)
2172 conversion_obstack_alloc (sizeof (struct z_candidate));
2173
2174 cand->fn = fn;
2175 cand->first_arg = first_arg;
2176 cand->args = args;
2177 cand->convs = convs;
2178 cand->num_convs = num_convs;
2179 cand->access_path = access_path;
2180 cand->conversion_path = conversion_path;
2181 cand->viable = viable;
2182 cand->reason = reason;
2183 cand->next = *candidates;
2184 cand->flags = flags;
2185 *candidates = cand;
2186
2187 if (convs && cand->reversed ())
2188 /* Swap the conversions for comparison in joust; we'll swap them back
2189 before build_over_call. */
2190 std::swap (convs[0], convs[1]);
2191
2192 return cand;
2193}
2194
2195/* Return the number of remaining arguments in the parameter list
2196 beginning with ARG. */
2197
2198int
2199remaining_arguments (tree arg)
2200{
2201 int n;
2202
2203 for (n = 0; arg != NULL_TREE(tree) __null && arg != void_list_nodeglobal_trees[TI_VOID_LIST_NODE];
2204 arg = TREE_CHAIN (arg)((contains_struct_check ((arg), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2204, __FUNCTION__))->common.chain)
)
2205 n++;
2206
2207 return n;
2208}
2209
2210/* [over.match.copy]: When initializing a temporary object (12.2) to be bound
2211 to the first parameter of a constructor where the parameter is of type
2212 "reference to possibly cv-qualified T" and the constructor is called with a
2213 single argument in the context of direct-initialization of an object of type
2214 "cv2 T", explicit conversion functions are also considered.
2215
2216 So set LOOKUP_COPY_PARM to let reference_binding know that
2217 it's being called in that context. */
2218
2219int
2220conv_flags (int i, int nargs, tree fn, tree arg, int flags)
2221{
2222 int lflags = flags;
2223 tree t;
2224 if (i == 0 && nargs == 1 && DECL_CONSTRUCTOR_P (fn)((tree_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2224, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2224, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
2225 && (t = FUNCTION_FIRST_USER_PARMTYPE (fn)skip_artificial_parms_for ((fn), ((tree_check2 ((((contains_struct_check
((fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2225, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2225, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values))
)
2226 && (same_type_ignoring_top_level_qualifiers_p
2227 (non_reference (TREE_VALUE (t)((tree_check ((t), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2227, __FUNCTION__, (TREE_LIST)))->list.value)
), DECL_CONTEXT (fn)((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2227, __FUNCTION__))->decl_minimal.context)
)))
2228 {
2229 if (!(flags & LOOKUP_ONLYCONVERTING(1 << 2)))
2230 lflags |= LOOKUP_COPY_PARM(((((1 << 6) << 1) << 1) << 1) <<
1)
;
2231 if ((flags & LOOKUP_LIST_INIT_CTOR((((1 << 6) << 1) << 1) << 1))
2232 && BRACE_ENCLOSED_INITIALIZER_P (arg)(((enum tree_code) (arg)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2232, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
2233 lflags |= LOOKUP_NO_CONVERSION(1 << 4);
2234 }
2235 else
2236 lflags |= LOOKUP_ONLYCONVERTING(1 << 2);
2237
2238 return lflags;
2239}
2240
2241/* Build an appropriate 'this' conversion for the method FN and class
2242 type CTYPE from the value ARG (having type ARGTYPE) to the type PARMTYPE.
2243 This function modifies PARMTYPE, ARGTYPE and ARG. */
2244
2245static conversion *
2246build_this_conversion (tree fn, tree ctype,
2247 tree& parmtype, tree& argtype, tree& arg,
2248 int flags, tsubst_flags_t complain)
2249{
2250 gcc_assert (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)((void)(!((((enum tree_code) (((contains_struct_check ((fn), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2250, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
) && !((tree_check (((((enum tree_code) (fn)->base
.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast
<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2251, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2251, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2251, __FUNCTION__), 0 : 0))
2251 && !DECL_CONSTRUCTOR_P (fn))((void)(!((((enum tree_code) (((contains_struct_check ((fn), (
TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2250, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
) && !((tree_check (((((enum tree_code) (fn)->base
.code) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast
<union tree_node *> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2251, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2251, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2251, __FUNCTION__), 0 : 0))
;
2252
2253 /* The type of the implicit object parameter ('this') for
2254 overload resolution is not always the same as for the
2255 function itself; conversion functions are considered to
2256 be members of the class being converted, and functions
2257 introduced by a using-declaration are considered to be
2258 members of the class that uses them.
2259
2260 Since build_over_call ignores the ICS for the `this'
2261 parameter, we can just change the parm type. */
2262 parmtype = cp_build_qualified_type (ctype,cp_build_qualified_type_real ((ctype), (cp_type_quals (((contains_struct_check
((parmtype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2263, __FUNCTION__))->typed.type))), tf_warning_or_error
)
2263 cp_type_quals (TREE_TYPE (parmtype)))cp_build_qualified_type_real ((ctype), (cp_type_quals (((contains_struct_check
((parmtype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2263, __FUNCTION__))->typed.type))), tf_warning_or_error
)
;
2264 bool this_p = true;
2265 if (FUNCTION_REF_QUALIFIED (TREE_TYPE (fn))((tree_not_check2 (((tree_check2 ((((contains_struct_check ((
fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2265, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2265, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2265, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_4)
)
2266 {
2267 /* If the function has a ref-qualifier, the implicit
2268 object parameter has reference type. */
2269 bool rv = FUNCTION_RVALUE_QUALIFIED (TREE_TYPE (fn))((tree_not_check2 (((tree_check2 ((((contains_struct_check ((
fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2269, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2269, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2269, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_5)
;
2270 parmtype = cp_build_reference_type (parmtype, rv);
2271 /* The special handling of 'this' conversions in compare_ics
2272 does not apply if there is a ref-qualifier. */
2273 this_p = false;
2274 }
2275 else
2276 {
2277 parmtype = build_pointer_type (parmtype);
2278 /* We don't use build_this here because we don't want to
2279 capture the object argument until we've chosen a
2280 non-static member function. */
2281 arg = build_address (arg);
2282 argtype = lvalue_type (arg);
2283 }
2284 flags |= LOOKUP_ONLYCONVERTING(1 << 2);
2285 conversion *t = implicit_conversion (parmtype, argtype, arg,
2286 /*c_cast_p=*/false, flags, complain);
2287 t->this_p = this_p;
2288 return t;
2289}
2290
2291/* Create an overload candidate for the function or method FN called
2292 with the argument list FIRST_ARG/ARGS and add it to CANDIDATES.
2293 FLAGS is passed on to implicit_conversion.
2294
2295 This does not change ARGS.
2296
2297 CTYPE, if non-NULL, is the type we want to pretend this function
2298 comes from for purposes of overload resolution.
2299
2300 SHORTCUT_BAD_CONVS controls how we handle "bad" argument conversions.
2301 If true, we stop computing conversions upon seeing the first bad
2302 conversion. This is used by add_candidates to avoid computing
2303 more conversions than necessary in the presence of a strictly viable
2304 candidate, while preserving the defacto behavior of overload resolution
2305 when it turns out there are only non-strictly viable candidates. */
2306
2307static struct z_candidate *
2308add_function_candidate (struct z_candidate **candidates,
2309 tree fn, tree ctype, tree first_arg,
2310 const vec<tree, va_gc> *args, tree access_path,
2311 tree conversion_path, int flags,
2312 conversion **convs,
2313 bool shortcut_bad_convs,
2314 tsubst_flags_t complain)
2315{
2316 tree parmlist = TYPE_ARG_TYPES (TREE_TYPE (fn))((tree_check2 ((((contains_struct_check ((fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2316, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2316, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)
;
2317 int i, len;
2318 tree parmnode;
2319 tree orig_first_arg = first_arg;
2320 int skip;
2321 int viable = 1;
2322 struct rejection_reason *reason = NULL__null;
2323
2324 /* The `this', `in_chrg' and VTT arguments to constructors are not
2325 considered in overload resolution. */
2326 if (DECL_CONSTRUCTOR_P (fn)((tree_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2326, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2326, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
2327 {
2328 if (ctor_omit_inherited_parms (fn))
2329 /* Bring back parameters omitted from an inherited ctor. */
2330 parmlist = FUNCTION_FIRST_USER_PARMTYPE (DECL_ORIGIN (fn))skip_artificial_parms_for (((((contains_struct_check ((fn), (
TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2330, __FUNCTION__))->decl_common.abstract_origin) ? ((contains_struct_check
((fn), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2330, __FUNCTION__))->decl_common.abstract_origin) : (fn
))), ((tree_check2 ((((contains_struct_check (((((contains_struct_check
((fn), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2330, __FUNCTION__))->decl_common.abstract_origin) ? ((contains_struct_check
((fn), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2330, __FUNCTION__))->decl_common.abstract_origin) : (fn
))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2330, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2330, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values))
;
2331 else
2332 parmlist = skip_artificial_parms_for (fn, parmlist);
2333 skip = num_artificial_parms_for (fn);
2334 if (skip > 0 && first_arg != NULL_TREE(tree) __null)
2335 {
2336 --skip;
2337 first_arg = NULL_TREE(tree) __null;
2338 }
2339 }
2340 else
2341 skip = 0;
2342
2343 len = vec_safe_length (args) - skip + (first_arg != NULL_TREE(tree) __null ? 1 : 0);
2344 if (!convs)
2345 convs = alloc_conversions (len);
2346
2347 /* 13.3.2 - Viable functions [over.match.viable]
2348 First, to be a viable function, a candidate function shall have enough
2349 parameters to agree in number with the arguments in the list.
2350
2351 We need to check this first; otherwise, checking the ICSes might cause
2352 us to produce an ill-formed template instantiation. */
2353
2354 parmnode = parmlist;
2355 for (i = 0; i < len; ++i)
2356 {
2357 if (parmnode == NULL_TREE(tree) __null || parmnode == void_list_nodeglobal_trees[TI_VOID_LIST_NODE])
2358 break;
2359 parmnode = TREE_CHAIN (parmnode)((contains_struct_check ((parmnode), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2359, __FUNCTION__))->common.chain)
;
2360 }
2361
2362 if ((i < len && parmnode)
2363 || !sufficient_parms_p (parmnode))
2364 {
2365 int remaining = remaining_arguments (parmnode);
2366 viable = 0;
2367 reason = arity_rejection (first_arg, i + remaining, len);
2368 }
2369
2370 /* An inherited constructor (12.6.3 [class.inhctor.init]) that has a first
2371 parameter of type "reference to cv C" (including such a constructor
2372 instantiated from a template) is excluded from the set of candidate
2373 functions when used to construct an object of type D with an argument list
2374 containing a single argument if C is reference-related to D. */
2375 if (viable && len == 1 && parmlist && DECL_CONSTRUCTOR_P (fn)((tree_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2375, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2375, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
2376 && flag_new_inheriting_ctorsglobal_options.x_flag_new_inheriting_ctors
2377 && DECL_INHERITED_CTOR (fn)((((enum tree_code) (fn)->base.code) == FUNCTION_DECL || (
((enum tree_code) (fn)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2377, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2377, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) && ((tree_check (((((enum
tree_code) (fn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2377, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2377, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? (
(struct tree_template_decl *)(const_cast<union tree_node *
> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2377, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2377, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (fn)->base.code) == FUNCTION_DECL || (((
enum tree_code) (fn)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2377, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2377, __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/call.c"
, 2377, __FUNCTION__); &lt->u.fn; })->context : (tree
) __null)
)
2378 {
2379 tree ptype = non_reference (TREE_VALUE (parmlist)((tree_check ((parmlist), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2379, __FUNCTION__, (TREE_LIST)))->list.value)
);
2380 tree dtype = DECL_CONTEXT (fn)((contains_struct_check ((fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2380, __FUNCTION__))->decl_minimal.context)
;
2381 tree btype = DECL_INHERITED_CTOR_BASE (fn)(((((enum tree_code) (fn)->base.code) == FUNCTION_DECL || (
((enum tree_code) (fn)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2381, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2381, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) && ((tree_check (((((enum
tree_code) (fn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2381, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2381, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? (
(struct tree_template_decl *)(const_cast<union tree_node *
> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2381, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2381, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (fn)->base.code) == FUNCTION_DECL || (((
enum tree_code) (fn)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2381, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2381, __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/call.c"
, 2381, __FUNCTION__); &lt->u.fn; })->context : (tree
) __null) ? ((contains_struct_check ((global_options.x_flag_new_inheriting_ctors
? strip_inheriting_ctors (fn) : ((((enum tree_code) (fn)->
base.code) == FUNCTION_DECL || (((enum tree_code) (fn)->base
.code) == TEMPLATE_DECL && ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2381, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2381, __FUNCTION__, (TEMPLATE_DECL))))))))->result)->
base.code) == FUNCTION_DECL)) && ((tree_check (((((enum
tree_code) (fn)->base.code) == TEMPLATE_DECL ? ((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2381, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2381, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
) ? __extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? (
(struct tree_template_decl *)(const_cast<union tree_node *
> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2381, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2381, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (fn)->base.code) == FUNCTION_DECL || (((
enum tree_code) (fn)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2381, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2381, __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/call.c"
, 2381, __FUNCTION__); &lt->u.fn; })->context : (tree
) __null)), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2381, __FUNCTION__))->decl_minimal.context) : (tree) __null
)
;
2382 if (reference_related_p (ptype, dtype)
2383 && reference_related_p (btype, ptype))
2384 {
2385 viable = false;
2386 reason = inherited_ctor_rejection ();
2387 }
2388 }
2389
2390 /* Second, for a function to be viable, its constraints must be
2391 satisfied. */
2392 if (flag_conceptsglobal_options.x_flag_concepts && viable && !constraints_satisfied_p (fn))
2393 {
2394 reason = constraint_failure ();
2395 viable = false;
2396 }
2397
2398 /* When looking for a function from a subobject from an implicit
2399 copy/move constructor/operator=, don't consider anything that takes (a
2400 reference to) an unrelated type. See c++/44909 and core 1092. */
2401 if (viable && parmlist && (flags & LOOKUP_DEFAULTED((((((((1 << 6) << 1) << 1) << 1) <<
1) << 1) << 1) << 1)
))
2402 {
2403 if (DECL_CONSTRUCTOR_P (fn)((tree_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2403, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2403, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
2404 i = 1;
2405 else if (DECL_ASSIGNMENT_OPERATOR_P (fn)(((((tree_not_check2 (((tree_check ((((contains_struct_check (
(fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2405, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2405, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2405, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_2)) & (!((tree_not_check2 (((tree_check ((((contains_struct_check
((fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2405, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2405, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2405, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_1))) & ((tree_not_check2 (((tree_check ((((contains_struct_check
((fn), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2405, __FUNCTION__))->decl_minimal.name)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2405, __FUNCTION__, (IDENTIFIER_NODE)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2405, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_0))
2406 && DECL_OVERLOADED_OPERATOR_IS (fn, NOP_EXPR)((__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? (
(struct tree_template_decl *)(const_cast<union tree_node *
> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2406, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2406, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (fn)->base.code) == FUNCTION_DECL || (((
enum tree_code) (fn)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2406, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2406, __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/call.c"
, 2406, __FUNCTION__); &lt->u.fn; })->ovl_op_code) ==
OVL_OP_NOP_EXPR)
)
2407 i = 2;
2408 else
2409 i = 0;
2410 if (i && len == i)
2411 {
2412 parmnode = chain_index (i-1, parmlist);
2413 if (!reference_related_p (non_reference (TREE_VALUE (parmnode)((tree_check ((parmnode), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2413, __FUNCTION__, (TREE_LIST)))->list.value)
),
2414 ctype))
2415 viable = 0;
2416 }
2417
2418 /* This only applies at the top level. */
2419 flags &= ~LOOKUP_DEFAULTED((((((((1 << 6) << 1) << 1) << 1) <<
1) << 1) << 1) << 1)
;
2420 }
2421
2422 if (! viable)
2423 goto out;
2424
2425 /* Third, for F to be a viable function, there shall exist for each
2426 argument an implicit conversion sequence that converts that argument
2427 to the corresponding parameter of F. */
2428
2429 parmnode = parmlist;
2430
2431 for (i = 0; i < len; ++i)
2432 {
2433 tree argtype, to_type;
2434 tree arg;
2435
2436 if (parmnode == void_list_nodeglobal_trees[TI_VOID_LIST_NODE])
2437 break;
2438
2439 if (convs[i])
2440 {
2441 /* Already set during deduction. */
2442 parmnode = TREE_CHAIN (parmnode)((contains_struct_check ((parmnode), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2442, __FUNCTION__))->common.chain)
;
2443 continue;
2444 }
2445
2446 if (i == 0 && first_arg != NULL_TREE(tree) __null)
2447 arg = first_arg;
2448 else
2449 arg = CONST_CAST_TREE ((const_cast<union tree_node *> ((((*args)[i + skip - (first_arg
!= (tree) __null ? 1 : 0)]))))
2450 (*args)[i + skip - (first_arg != NULL_TREE ? 1 : 0)])(const_cast<union tree_node *> ((((*args)[i + skip - (first_arg
!= (tree) __null ? 1 : 0)]))))
;
2451 argtype = lvalue_type (arg);
2452
2453 conversion *t;
2454 if (parmnode)
2455 {
2456 tree parmtype = TREE_VALUE (parmnode)((tree_check ((parmnode), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2456, __FUNCTION__, (TREE_LIST)))->list.value)
;
2457 if (i == 0
2458 && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)(((enum tree_code) (((contains_struct_check ((fn), (TS_TYPED)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2458, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)
2459 && !DECL_CONSTRUCTOR_P (fn)((tree_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2459, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2459, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
2460 t = build_this_conversion (fn, ctype, parmtype, argtype, arg,
2461 flags, complain);
2462 else
2463 {
2464 int lflags = conv_flags (i, len-skip, fn, arg, flags);
2465 t = implicit_conversion (parmtype, argtype, arg,
2466 /*c_cast_p=*/false, lflags, complain);
2467 }
2468 to_type = parmtype;
2469 parmnode = TREE_CHAIN (parmnode)((contains_struct_check ((parmnode), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2469, __FUNCTION__))->common.chain)
;
2470 }
2471 else
2472 {
2473 t = build_identity_conv (argtype, arg);
2474 t->ellipsis_p = true;
2475 to_type = argtype;
2476 }
2477
2478 convs[i] = t;
2479 if (! t)
2480 {
2481 viable = 0;
2482 reason = arg_conversion_rejection (first_arg, i, argtype, to_type,
2483 EXPR_LOCATION (arg)((((arg)) && ((tree_code_type[(int) (((enum tree_code
) ((arg))->base.code))]) >= tcc_reference && (tree_code_type
[(int) (((enum tree_code) ((arg))->base.code))]) <= tcc_expression
)) ? (arg)->exp.locus : ((location_t) 0))
);
2484 break;
2485 }
2486
2487 if (t->bad_p)
2488 {
2489 viable = -1;
2490 reason = bad_arg_conversion_rejection (first_arg, i, arg, to_type,
2491 EXPR_LOCATION (arg)((((arg)) && ((tree_code_type[(int) (((enum tree_code
) ((arg))->base.code))]) >= tcc_reference && (tree_code_type
[(int) (((enum tree_code) ((arg))->base.code))]) <= tcc_expression
)) ? (arg)->exp.locus : ((location_t) 0))
);
2492 if (shortcut_bad_convs)
2493 break;
2494 }
2495 }
2496
2497 out:
2498 return add_candidate (candidates, fn, orig_first_arg, args, len, convs,
2499 access_path, conversion_path, viable, reason, flags);
2500}
2501
2502/* Create an overload candidate for the conversion function FN which will
2503 be invoked for expression OBJ, producing a pointer-to-function which
2504 will in turn be called with the argument list FIRST_ARG/ARGLIST,
2505 and add it to CANDIDATES. This does not change ARGLIST. FLAGS is
2506 passed on to implicit_conversion.
2507
2508 Actually, we don't really care about FN; we care about the type it
2509 converts to. There may be multiple conversion functions that will
2510 convert to that type, and we rely on build_user_type_conversion_1 to
2511 choose the best one; so when we create our candidate, we record the type
2512 instead of the function. */
2513
2514static struct z_candidate *
2515add_conv_candidate (struct z_candidate **candidates, tree fn, tree obj,
2516 const vec<tree, va_gc> *arglist,
2517 tree access_path, tree conversion_path,
2518 tsubst_flags_t complain)
2519{
2520 tree totype = TREE_TYPE (TREE_TYPE (fn))((contains_struct_check ((((contains_struct_check ((fn), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2520, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2520, __FUNCTION__))->typed.type)
;
2521 int i, len, viable, flags;
2522 tree parmlist, parmnode;
2523 conversion **convs;
2524 struct rejection_reason *reason;
2525
2526 for (parmlist = totype; TREE_CODE (parmlist)((enum tree_code) (parmlist)->base.code) != FUNCTION_TYPE; )
2527 parmlist = TREE_TYPE (parmlist)((contains_struct_check ((parmlist), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2527, __FUNCTION__))->typed.type)
;
2528 parmlist = TYPE_ARG_TYPES (parmlist)((tree_check2 ((parmlist), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2528, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)
;
2529
2530 len = vec_safe_length (arglist) + 1;
2531 convs = alloc_conversions (len);
2532 parmnode = parmlist;
2533 viable = 1;
2534 flags = LOOKUP_IMPLICIT(((1 << 0)) | (1 << 2));
2535 reason = NULL__null;
2536
2537 /* Don't bother looking up the same type twice. */
2538 if (*candidates && (*candidates)->fn == totype)
2539 return NULL__null;
2540
2541 for (i = 0; i < len; ++i)
2542 {
2543 tree arg, argtype, convert_type = NULL_TREE(tree) __null;
2544 conversion *t;
2545
2546 if (i == 0)
2547 arg = obj;
2548 else
2549 arg = (*arglist)[i - 1];
2550 argtype = lvalue_type (arg);
2551
2552 if (i == 0)
2553 {
2554 t = build_identity_conv (argtype, NULL_TREE(tree) __null);
2555 t = build_conv (ck_user, totype, t);
2556 /* Leave the 'cand' field null; we'll figure out the conversion in
2557 convert_like if this candidate is chosen. */
2558 convert_type = totype;
2559 }
2560 else if (parmnode == void_list_nodeglobal_trees[TI_VOID_LIST_NODE])
2561 break;
2562 else if (parmnode)
2563 {
2564 t = implicit_conversion (TREE_VALUE (parmnode)((tree_check ((parmnode), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2564, __FUNCTION__, (TREE_LIST)))->list.value)
, argtype, arg,
2565 /*c_cast_p=*/false, flags, complain);
2566 convert_type = TREE_VALUE (parmnode)((tree_check ((parmnode), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2566, __FUNCTION__, (TREE_LIST)))->list.value)
;
2567 }
2568 else
2569 {
2570 t = build_identity_conv (argtype, arg);
2571 t->ellipsis_p = true;
2572 convert_type = argtype;
2573 }
2574
2575 convs[i] = t;
2576 if (! t)
2577 break;
2578
2579 if (t->bad_p)
2580 {
2581 viable = -1;
2582 reason = bad_arg_conversion_rejection (NULL_TREE(tree) __null, i, arg, convert_type,
2583 EXPR_LOCATION (arg)((((arg)) && ((tree_code_type[(int) (((enum tree_code
) ((arg))->base.code))]) >= tcc_reference && (tree_code_type
[(int) (((enum tree_code) ((arg))->base.code))]) <= tcc_expression
)) ? (arg)->exp.locus : ((location_t) 0))
);
2584 }
2585
2586 if (i == 0)
2587 continue;
2588
2589 if (parmnode)
2590 parmnode = TREE_CHAIN (parmnode)((contains_struct_check ((parmnode), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2590, __FUNCTION__))->common.chain)
;
2591 }
2592
2593 if (i < len
2594 || ! sufficient_parms_p (parmnode))
2595 {
2596 int remaining = remaining_arguments (parmnode);
2597 viable = 0;
2598 reason = arity_rejection (NULL_TREE(tree) __null, i + remaining, len);
2599 }
2600
2601 return add_candidate (candidates, totype, obj, arglist, len, convs,
2602 access_path, conversion_path, viable, reason, flags);
2603}
2604
2605static void
2606build_builtin_candidate (struct z_candidate **candidates, tree fnname,
2607 tree type1, tree type2, const vec<tree,va_gc> &args,
2608 tree *argtypes, int flags, tsubst_flags_t complain)
2609{
2610 conversion *t;
2611 conversion **convs;
2612 size_t num_convs;
2613 int viable = 1;
2614 tree types[2];
2615 struct rejection_reason *reason = NULL__null;
2616
2617 types[0] = type1;
2618 types[1] = type2;
2619
2620 num_convs = args.length ();
2621 convs = alloc_conversions (num_convs);
2622
2623 /* TRUTH_*_EXPR do "contextual conversion to bool", which means explicit
2624 conversion ops are allowed. We handle that here by just checking for
2625 boolean_type_node because other operators don't ask for it. COND_EXPR
2626 also does contextual conversion to bool for the first operand, but we
2627 handle that in build_conditional_expr, and type1 here is operand 2. */
2628 if (type1 != boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE])
2629 flags |= LOOKUP_ONLYCONVERTING(1 << 2);
2630
2631 for (unsigned i = 0; i < 2 && i < num_convs; ++i)
2632 {
2633 t = implicit_conversion (types[i], argtypes[i], args[i],
2634 /*c_cast_p=*/false, flags, complain);
2635 if (! t)
2636 {
2637 viable = 0;
2638 /* We need something for printing the candidate. */
2639 t = build_identity_conv (types[i], NULL_TREE(tree) __null);
2640 reason = arg_conversion_rejection (NULL_TREE(tree) __null, i, argtypes[i],
2641 types[i], EXPR_LOCATION (args[i])((((args[i])) && ((tree_code_type[(int) (((enum tree_code
) ((args[i]))->base.code))]) >= tcc_reference &&
(tree_code_type[(int) (((enum tree_code) ((args[i]))->base
.code))]) <= tcc_expression)) ? (args[i])->exp.locus : (
(location_t) 0))
);
2642 }
2643 else if (t->bad_p)
2644 {
2645 viable = 0;
2646 reason = bad_arg_conversion_rejection (NULL_TREE(tree) __null, i, args[i],
2647 types[i],
2648 EXPR_LOCATION (args[i])((((args[i])) && ((tree_code_type[(int) (((enum tree_code
) ((args[i]))->base.code))]) >= tcc_reference &&
(tree_code_type[(int) (((enum tree_code) ((args[i]))->base
.code))]) <= tcc_expression)) ? (args[i])->exp.locus : (
(location_t) 0))
);
2649 }
2650 convs[i] = t;
2651 }
2652
2653 /* For COND_EXPR we rearranged the arguments; undo that now. */
2654 if (num_convs == 3)
2655 {
2656 convs[2] = convs[1];
2657 convs[1] = convs[0];
2658 t = implicit_conversion (boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], argtypes[2], args[2],
2659 /*c_cast_p=*/false, flags,
2660 complain);
2661 if (t)
2662 convs[0] = t;
2663 else
2664 {
2665 viable = 0;
2666 reason = arg_conversion_rejection (NULL_TREE(tree) __null, 0, argtypes[2],
2667 boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE],
2668 EXPR_LOCATION (args[2])((((args[2])) && ((tree_code_type[(int) (((enum tree_code
) ((args[2]))->base.code))]) >= tcc_reference &&
(tree_code_type[(int) (((enum tree_code) ((args[2]))->base
.code))]) <= tcc_expression)) ? (args[2])->exp.locus : (
(location_t) 0))
);
2669 }
2670 }
2671
2672 add_candidate (candidates, fnname, /*first_arg=*/NULL_TREE(tree) __null, /*args=*/NULL__null,
2673 num_convs, convs,
2674 /*access_path=*/NULL_TREE(tree) __null,
2675 /*conversion_path=*/NULL_TREE(tree) __null,
2676 viable, reason, flags);
2677}
2678
2679static bool
2680is_complete (tree t)
2681{
2682 return COMPLETE_TYPE_P (complete_type (t))(((tree_class_check ((complete_type (t)), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2682, __FUNCTION__))->type_common.size) != (tree) __null
)
;
2683}
2684
2685/* Returns nonzero if TYPE is a promoted arithmetic type. */
2686
2687static bool
2688promoted_arithmetic_type_p (tree type)
2689{
2690 /* [over.built]
2691
2692 In this section, the term promoted integral type is used to refer
2693 to those integral types which are preserved by integral promotion
2694 (including e.g. int and long but excluding e.g. char).
2695 Similarly, the term promoted arithmetic type refers to promoted
2696 integral types plus floating types. */
2697 return ((CP_INTEGRAL_TYPE_P (type)(((enum tree_code) (type)->base.code) == BOOLEAN_TYPE || (
(enum tree_code) (type)->base.code) == INTEGER_TYPE)
2698 && same_type_p (type_promotes_to (type), type)comptypes ((type_promotes_to (type)), (type), 0))
2699 || TREE_CODE (type)((enum tree_code) (type)->base.code) == REAL_TYPE);
2700}
2701
2702/* Create any builtin operator overload candidates for the operator in
2703 question given the converted operand types TYPE1 and TYPE2. The other
2704 args are passed through from add_builtin_candidates to
2705 build_builtin_candidate.
2706
2707 TYPE1 and TYPE2 may not be permissible, and we must filter them.
2708 If CODE is requires candidates operands of the same type of the kind
2709 of which TYPE1 and TYPE2 are, we add both candidates
2710 CODE (TYPE1, TYPE1) and CODE (TYPE2, TYPE2). */
2711
2712static void
2713add_builtin_candidate (struct z_candidate **candidates, enum tree_code code,
2714 enum tree_code code2, tree fnname, tree type1,
2715 tree type2, vec<tree,va_gc> &args, tree *argtypes,
2716 int flags, tsubst_flags_t complain)
2717{
2718 switch (code)
2719 {
2720 case POSTINCREMENT_EXPR:
2721 case POSTDECREMENT_EXPR:
2722 args[1] = integer_zero_nodeglobal_trees[TI_INTEGER_ZERO];
2723 type2 = integer_type_nodeinteger_types[itk_int];
2724 break;
2725 default:
2726 break;
2727 }
2728
2729 switch (code)
2730 {
2731
2732/* 4 For every pair (T, VQ), where T is an arithmetic type other than bool,
2733 and VQ is either volatile or empty, there exist candidate operator
2734 functions of the form
2735 VQ T& operator++(VQ T&);
2736 T operator++(VQ T&, int);
2737 5 For every pair (T, VQ), where T is an arithmetic type other than bool,
2738 and VQ is either volatile or empty, there exist candidate operator
2739 functions of the form
2740 VQ T& operator--(VQ T&);
2741 T operator--(VQ T&, int);
2742 6 For every pair (T, VQ), where T is a cv-qualified or cv-unqualified object
2743 type, and VQ is either volatile or empty, there exist candidate operator
2744 functions of the form
2745 T*VQ& operator++(T*VQ&);
2746 T*VQ& operator--(T*VQ&);
2747 T* operator++(T*VQ&, int);
2748 T* operator--(T*VQ&, int); */
2749
2750 case POSTDECREMENT_EXPR:
2751 case PREDECREMENT_EXPR:
2752 if (TREE_CODE (type1)((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE)
2753 return;
2754 /* FALLTHRU */
2755 case POSTINCREMENT_EXPR:
2756 case PREINCREMENT_EXPR:
2757 /* P0002R1, Remove deprecated operator++(bool) added "other than bool"
2758 to p4. */
2759 if (TREE_CODE (type1)((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE && cxx_dialect >= cxx17)
2760 return;
2761 if (ARITHMETIC_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE ||
((enum tree_code) (type1)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (type1)->base.code) == REAL_TYPE || ((enum
tree_code) (type1)->base.code) == COMPLEX_TYPE)
|| TYPE_PTROB_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) &&
(!(((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2761, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2761, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2761, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2761, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)))
)
2762 {
2763 type1 = build_reference_type (type1);
2764 break;
2765 }
2766 return;
2767
2768/* 7 For every cv-qualified or cv-unqualified object type T, there
2769 exist candidate operator functions of the form
2770
2771 T& operator*(T*);
2772
2773
2774 8 For every function type T that does not have cv-qualifiers or
2775 a ref-qualifier, there exist candidate operator functions of the form
2776 T& operator*(T*); */
2777
2778 case INDIRECT_REF:
2779 if (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE)
2780 && (TYPE_PTROB_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) &&
(!(((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2780, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2780, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2780, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2780, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)))
2781 || TREE_CODE (TREE_TYPE (type1))((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2781, __FUNCTION__))->typed.type))->base.code)
== FUNCTION_TYPE))
2782 break;
2783 return;
2784
2785/* 9 For every type T, there exist candidate operator functions of the form
2786 T* operator+(T*);
2787
2788 10 For every floating-point or promoted integral type T, there exist
2789 candidate operator functions of the form
2790 T operator+(T);
2791 T operator-(T); */
2792
2793 case UNARY_PLUS_EXPR: /* unary + */
2794 if (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE))
2795 break;
2796 /* FALLTHRU */
2797 case NEGATE_EXPR:
2798 if (ARITHMETIC_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE ||
((enum tree_code) (type1)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (type1)->base.code) == REAL_TYPE || ((enum
tree_code) (type1)->base.code) == COMPLEX_TYPE)
)
2799 break;
2800 return;
2801
2802/* 11 For every promoted integral type T, there exist candidate operator
2803 functions of the form
2804 T operator~(T); */
2805
2806 case BIT_NOT_EXPR:
2807 if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2807, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type1)->base.code) == INTEGER_TYPE)
)
)
2808 break;
2809 return;
2810
2811/* 12 For every quintuple (C1, C2, T, CV1, CV2), where C2 is a class type, C1
2812 is the same type as C2 or is a derived class of C2, and T is an object
2813 type or a function type there exist candidate operator functions of the
2814 form
2815 CV12 T& operator->*(CV1 C1*, CV2 T C2::*);
2816 where CV12 is the union of CV1 and CV2. */
2817
2818 case MEMBER_REF:
2819 if (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE) && TYPE_PTRMEM_P (type2)((((enum tree_code) (type2)->base.code) == OFFSET_TYPE) ||
(((enum tree_code) (type2)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2819, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2819, __FUNCTION__))->type_common.lang_flag_2))))
)
2820 {
2821 tree c1 = TREE_TYPE (type1)((contains_struct_check ((type1), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2821, __FUNCTION__))->typed.type)
;
2822 tree c2 = TYPE_PTRMEM_CLASS_TYPE (type2)((((enum tree_code) (type2)->base.code) == OFFSET_TYPE) ? (
(tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2822, __FUNCTION__, (OFFSET_TYPE)))->type_non_common.maxval
) : ((tree_check2 ((((contains_struct_check (((cp_build_qualified_type_real
((((contains_struct_check ((((tree_check3 ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2822, __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/call.c"
, 2822, __FUNCTION__))->typed.type)), (cp_type_quals (type2
)), tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2822, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2822, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.maxval))
;
2823
2824 if (MAYBE_CLASS_TYPE_P (c1)((((enum tree_code) (c1)->base.code) == TEMPLATE_TYPE_PARM
|| ((enum tree_code) (c1)->base.code) == TYPENAME_TYPE ||
((enum tree_code) (c1)->base.code) == TYPEOF_TYPE || ((enum
tree_code) (c1)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (c1)->base.code) == DECLTYPE_TYPE) ||
(((((enum tree_code) (c1)->base.code)) == RECORD_TYPE || (
((enum tree_code) (c1)->base.code)) == UNION_TYPE) &&
((tree_class_check ((c1), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2824, __FUNCTION__))->type_common.lang_flag_5)))
&& DERIVED_FROM_P (c2, c1)(lookup_base ((c1), (c2), ba_any, __null, tf_none) != (tree) __null
)
2825 && (TYPE_PTRMEMFUNC_P (type2)(((enum tree_code) (type2)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2825, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2825, __FUNCTION__))->type_common.lang_flag_2)))
2826 || is_complete (TYPE_PTRMEM_POINTED_TO_TYPE (type2)((((enum tree_code) (type2)->base.code) == OFFSET_TYPE) ? (
(contains_struct_check ((type2), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2826, __FUNCTION__))->typed.type) : ((contains_struct_check
(((cp_build_qualified_type_real ((((contains_struct_check ((
((tree_check3 ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2826, __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/call.c"
, 2826, __FUNCTION__))->typed.type)), (cp_type_quals (type2
)), tf_warning_or_error))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2826, __FUNCTION__))->typed.type))
)))
2827 break;
2828 }
2829 return;
2830
2831/* 13 For every pair of types L and R, where each of L and R is a floating-point
2832 or promoted integral type, there exist candidate operator functions of the
2833 form
2834 LR operator*(L, R);
2835 LR operator/(L, R);
2836 LR operator+(L, R);
2837 LR operator-(L, R);
2838 bool operator<(L, R);
2839 bool operator>(L, R);
2840 bool operator<=(L, R);
2841 bool operator>=(L, R);
2842 bool operator==(L, R);
2843 bool operator!=(L, R);
2844 where LR is the result of the usual arithmetic conversions between
2845 types L and R.
2846
2847 14 For every integral type T there exists a candidate operator function of
2848 the form
2849
2850 std::strong_ordering operator<=>(T, T);
2851
2852 15 For every pair of floating-point types L and R, there exists a candidate
2853 operator function of the form
2854
2855 std::partial_ordering operator<=>(L, R);
2856
2857 16 For every cv-qualified or cv-unqualified object type T there exist
2858 candidate operator functions of the form
2859 T* operator+(T*, std::ptrdiff_t);
2860 T& operator[](T*, std::ptrdiff_t);
2861 T* operator-(T*, std::ptrdiff_t);
2862 T* operator+(std::ptrdiff_t, T*);
2863 T& operator[](std::ptrdiff_t, T*);
2864
2865 17 For every T, where T is a pointer to object type, there exist candidate
2866 operator functions of the form
2867 std::ptrdiff_t operator-(T, T);
2868
2869 18 For every T, where T is an enumeration type or a pointer type, there
2870 exist candidate operator functions of the form
2871 bool operator<(T, T);
2872 bool operator>(T, T);
2873 bool operator<=(T, T);
2874 bool operator>=(T, T);
2875 bool operator==(T, T);
2876 bool operator!=(T, T);
2877 R operator<=>(T, T);
2878
2879 where R is the result type specified in [expr.spaceship].
2880
2881 19 For every T, where T is a pointer-to-member type or std::nullptr_t,
2882 there exist candidate operator functions of the form
2883 bool operator==(T, T);
2884 bool operator!=(T, T); */
2885
2886 case MINUS_EXPR:
2887 if (TYPE_PTROB_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) &&
(!(((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2887, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2887, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2887, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2887, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)))
&& TYPE_PTROB_P (type2)((((enum tree_code) (type2)->base.code) == POINTER_TYPE) &&
(!(((enum tree_code) (((contains_struct_check ((type2), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2887, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type2
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2887, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type2
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2887, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (((contains_struct_check ((type2), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2887, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)))
)
2888 break;
2889 if (TYPE_PTROB_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) &&
(!(((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2889, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2889, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2889, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2889, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)))
2890 && INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2890, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type2)->base.code) == INTEGER_TYPE)
)
)
2891 {
2892 type2 = ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE];
2893 break;
2894 }
2895 /* FALLTHRU */
2896 case MULT_EXPR:
2897 case TRUNC_DIV_EXPR:
2898 if (ARITHMETIC_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE ||
((enum tree_code) (type1)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (type1)->base.code) == REAL_TYPE || ((enum
tree_code) (type1)->base.code) == COMPLEX_TYPE)
&& ARITHMETIC_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE ||
((enum tree_code) (type2)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (type2)->base.code) == REAL_TYPE || ((enum
tree_code) (type2)->base.code) == COMPLEX_TYPE)
)
2899 break;
2900 return;
2901
2902 /* This isn't exactly what's specified above for operator<=>, but it's
2903 close enough. In particular, we don't care about the return type
2904 specified above; it doesn't participate in overload resolution and it
2905 doesn't affect the semantics of the built-in operator. */
2906 case SPACESHIP_EXPR:
2907 case EQ_EXPR:
2908 case NE_EXPR:
2909 if ((TYPE_PTRMEMFUNC_P (type1)(((enum tree_code) (type1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2909, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2909, __FUNCTION__))->type_common.lang_flag_2)))
&& TYPE_PTRMEMFUNC_P (type2)(((enum tree_code) (type2)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2909, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2909, __FUNCTION__))->type_common.lang_flag_2)))
)
2910 || (TYPE_PTRDATAMEM_P (type1)(((enum tree_code) (type1)->base.code) == OFFSET_TYPE) && TYPE_PTRDATAMEM_P (type2)(((enum tree_code) (type2)->base.code) == OFFSET_TYPE)))
2911 break;
2912 if (NULLPTR_TYPE_P (type1)(((enum tree_code) (type1)->base.code) == NULLPTR_TYPE) && NULLPTR_TYPE_P (type2)(((enum tree_code) (type2)->base.code) == NULLPTR_TYPE))
2913 break;
2914 if (TYPE_PTRMEM_P (type1)((((enum tree_code) (type1)->base.code) == OFFSET_TYPE) ||
(((enum tree_code) (type1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2914, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2914, __FUNCTION__))->type_common.lang_flag_2))))
&& null_ptr_cst_p (args[1]))
2915 {
2916 type2 = type1;
2917 break;
2918 }
2919 if (TYPE_PTRMEM_P (type2)((((enum tree_code) (type2)->base.code) == OFFSET_TYPE) ||
(((enum tree_code) (type2)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2919, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2919, __FUNCTION__))->type_common.lang_flag_2))))
&& null_ptr_cst_p (args[0]))
2920 {
2921 type1 = type2;
2922 break;
2923 }
2924 /* Fall through. */
2925 case LT_EXPR:
2926 case GT_EXPR:
2927 case LE_EXPR:
2928 case GE_EXPR:
2929 case MAX_EXPR:
2930 case MIN_EXPR:
2931 if (ARITHMETIC_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE ||
((enum tree_code) (type1)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (type1)->base.code) == REAL_TYPE || ((enum
tree_code) (type1)->base.code) == COMPLEX_TYPE)
&& ARITHMETIC_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE ||
((enum tree_code) (type2)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (type2)->base.code) == REAL_TYPE || ((enum
tree_code) (type2)->base.code) == COMPLEX_TYPE)
)
2932 break;
2933 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))
2934 break;
2935 if (TREE_CODE (type1)((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE
2936 && TREE_CODE (type2)((enum tree_code) (type2)->base.code) == ENUMERAL_TYPE)
2937 break;
2938 if (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE)
2939 && null_ptr_cst_p (args[1]))
2940 {
2941 type2 = type1;
2942 break;
2943 }
2944 if (null_ptr_cst_p (args[0])
2945 && TYPE_PTR_P (type2)(((enum tree_code) (type2)->base.code) == POINTER_TYPE))
2946 {
2947 type1 = type2;
2948 break;
2949 }
2950 return;
2951
2952 case PLUS_EXPR:
2953 if (ARITHMETIC_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE ||
((enum tree_code) (type1)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (type1)->base.code) == REAL_TYPE || ((enum
tree_code) (type1)->base.code) == COMPLEX_TYPE)
&& ARITHMETIC_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE ||
((enum tree_code) (type2)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (type2)->base.code) == REAL_TYPE || ((enum
tree_code) (type2)->base.code) == COMPLEX_TYPE)
)
2954 break;
2955 /* FALLTHRU */
2956 case ARRAY_REF:
2957 if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2957, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type1)->base.code) == INTEGER_TYPE)
)
&& TYPE_PTROB_P (type2)((((enum tree_code) (type2)->base.code) == POINTER_TYPE) &&
(!(((enum tree_code) (((contains_struct_check ((type2), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2957, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type2
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2957, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type2
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2957, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (((contains_struct_check ((type2), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2957, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)))
)
2958 {
2959 type1 = ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE];
2960 break;
2961 }
2962 if (TYPE_PTROB_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) &&
(!(((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2962, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2962, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2962, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2962, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)))
&& INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2962, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type2)->base.code) == INTEGER_TYPE)
)
)
2963 {
2964 type2 = ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE];
2965 break;
2966 }
2967 return;
2968
2969/* 18For every pair of promoted integral types L and R, there exist candi-
2970 date operator functions of the form
2971 LR operator%(L, R);
2972 LR operator&(L, R);
2973 LR operator^(L, R);
2974 LR operator|(L, R);
2975 L operator<<(L, R);
2976 L operator>>(L, R);
2977 where LR is the result of the usual arithmetic conversions between
2978 types L and R. */
2979
2980 case TRUNC_MOD_EXPR:
2981 case BIT_AND_EXPR:
2982 case BIT_IOR_EXPR:
2983 case BIT_XOR_EXPR:
2984 case LSHIFT_EXPR:
2985 case RSHIFT_EXPR:
2986 if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2986, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type1)->base.code) == INTEGER_TYPE)
)
&& INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 2986, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type2)->base.code) == INTEGER_TYPE)
)
)
2987 break;
2988 return;
2989
2990/* 19For every triple L, VQ, R), where L is an arithmetic or enumeration
2991 type, VQ is either volatile or empty, and R is a promoted arithmetic
2992 type, there exist candidate operator functions of the form
2993 VQ L& operator=(VQ L&, R);
2994 VQ L& operator*=(VQ L&, R);
2995 VQ L& operator/=(VQ L&, R);
2996 VQ L& operator+=(VQ L&, R);
2997 VQ L& operator-=(VQ L&, R);
2998
2999 20For every pair T, VQ), where T is any type and VQ is either volatile
3000 or empty, there exist candidate operator functions of the form
3001 T*VQ& operator=(T*VQ&, T*);
3002
3003 21For every pair T, VQ), where T is a pointer to member type and VQ is
3004 either volatile or empty, there exist candidate operator functions of
3005 the form
3006 VQ T& operator=(VQ T&, T);
3007
3008 22For every triple T, VQ, I), where T is a cv-qualified or cv-
3009 unqualified complete object type, VQ is either volatile or empty, and
3010 I is a promoted integral type, there exist candidate operator func-
3011 tions of the form
3012 T*VQ& operator+=(T*VQ&, I);
3013 T*VQ& operator-=(T*VQ&, I);
3014
3015 23For every triple L, VQ, R), where L is an integral or enumeration
3016 type, VQ is either volatile or empty, and R is a promoted integral
3017 type, there exist candidate operator functions of the form
3018
3019 VQ L& operator%=(VQ L&, R);
3020 VQ L& operator<<=(VQ L&, R);
3021 VQ L& operator>>=(VQ L&, R);
3022 VQ L& operator&=(VQ L&, R);
3023 VQ L& operator^=(VQ L&, R);
3024 VQ L& operator|=(VQ L&, R); */
3025
3026 case MODIFY_EXPR:
3027 switch (code2)
3028 {
3029 case PLUS_EXPR:
3030 case MINUS_EXPR:
3031 if (TYPE_PTROB_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) &&
(!(((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3031, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3031, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
) && !(((enum tree_code) (((contains_struct_check ((type1
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3031, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
|| ((enum tree_code) (((contains_struct_check ((type1), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3031, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)))
&& INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3031, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type2)->base.code) == INTEGER_TYPE)
)
)
3032 {
3033 type2 = ptrdiff_type_nodeglobal_trees[TI_PTRDIFF_TYPE];
3034 break;
3035 }
3036 /* FALLTHRU */
3037 case MULT_EXPR:
3038 case TRUNC_DIV_EXPR:
3039 if (ARITHMETIC_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE ||
((enum tree_code) (type1)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (type1)->base.code) == REAL_TYPE || ((enum
tree_code) (type1)->base.code) == COMPLEX_TYPE)
&& ARITHMETIC_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE ||
((enum tree_code) (type2)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (type2)->base.code) == REAL_TYPE || ((enum
tree_code) (type2)->base.code) == COMPLEX_TYPE)
)
3040 break;
3041 return;
3042
3043 case TRUNC_MOD_EXPR:
3044 case BIT_AND_EXPR:
3045 case BIT_IOR_EXPR:
3046 case BIT_XOR_EXPR:
3047 case LSHIFT_EXPR:
3048 case RSHIFT_EXPR:
3049 if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3049, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type1)->base.code) == INTEGER_TYPE)
)
&& INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == ENUMERAL_TYPE &&
!((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3049, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type2)->base.code) == INTEGER_TYPE)
)
)
3050 break;
3051 return;
3052
3053 case NOP_EXPR:
3054 if (ARITHMETIC_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE ||
((enum tree_code) (type1)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (type1)->base.code) == REAL_TYPE || ((enum
tree_code) (type1)->base.code) == COMPLEX_TYPE)
&& ARITHMETIC_TYPE_P (type2)((((enum tree_code) (type2)->base.code) == BOOLEAN_TYPE ||
((enum tree_code) (type2)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (type2)->base.code) == REAL_TYPE || ((enum
tree_code) (type2)->base.code) == COMPLEX_TYPE)
)
3055 break;
3056 if ((TYPE_PTRMEMFUNC_P (type1)(((enum tree_code) (type1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3056, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3056, __FUNCTION__))->type_common.lang_flag_2)))
&& TYPE_PTRMEMFUNC_P (type2)(((enum tree_code) (type2)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3056, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3056, __FUNCTION__))->type_common.lang_flag_2)))
)
3057 || (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE) && TYPE_PTR_P (type2)(((enum tree_code) (type2)->base.code) == POINTER_TYPE))
3058 || (TYPE_PTRDATAMEM_P (type1)(((enum tree_code) (type1)->base.code) == OFFSET_TYPE) && TYPE_PTRDATAMEM_P (type2)(((enum tree_code) (type2)->base.code) == OFFSET_TYPE))
3059 || ((TYPE_PTRMEMFUNC_P (type1)(((enum tree_code) (type1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3059, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3059, __FUNCTION__))->type_common.lang_flag_2)))
3060 || TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE))
3061 && null_ptr_cst_p (args[1])))
3062 {
3063 type2 = type1;
3064 break;
3065 }
3066 return;
3067
3068 default:
3069 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3069, __FUNCTION__))
;
3070 }
3071 type1 = build_reference_type (type1);
3072 break;
3073
3074 case COND_EXPR:
3075 /* [over.built]
3076
3077 For every pair of promoted arithmetic types L and R, there
3078 exist candidate operator functions of the form
3079
3080 LR operator?(bool, L, R);
3081
3082 where LR is the result of the usual arithmetic conversions
3083 between types L and R.
3084
3085 For every type T, where T is a pointer or pointer-to-member
3086 type, there exist candidate operator functions of the form T
3087 operator?(bool, T, T); */
3088
3089 if (promoted_arithmetic_type_p (type1)
3090 && promoted_arithmetic_type_p (type2))
3091 /* That's OK. */
3092 break;
3093
3094 /* Otherwise, the types should be pointers. */
3095 if (!TYPE_PTR_OR_PTRMEM_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) ||
((((enum tree_code) (type1)->base.code) == OFFSET_TYPE) ||
(((enum tree_code) (type1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3095, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3095, __FUNCTION__))->type_common.lang_flag_2)))))
|| !TYPE_PTR_OR_PTRMEM_P (type2)((((enum tree_code) (type2)->base.code) == POINTER_TYPE) ||
((((enum tree_code) (type2)->base.code) == OFFSET_TYPE) ||
(((enum tree_code) (type2)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3095, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3095, __FUNCTION__))->type_common.lang_flag_2)))))
)
3096 return;
3097
3098 /* We don't check that the two types are the same; the logic
3099 below will actually create two candidates; one in which both
3100 parameter types are TYPE1, and one in which both parameter
3101 types are TYPE2. */
3102 break;
3103
3104 case REALPART_EXPR:
3105 case IMAGPART_EXPR:
3106 if (ARITHMETIC_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == BOOLEAN_TYPE ||
((enum tree_code) (type1)->base.code) == INTEGER_TYPE) ||
((enum tree_code) (type1)->base.code) == REAL_TYPE || ((enum
tree_code) (type1)->base.code) == COMPLEX_TYPE)
)
3107 break;
3108 return;
3109
3110 default:
3111 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3111, __FUNCTION__))
;
3112 }
3113
3114 /* Make sure we don't create builtin candidates with dependent types. */
3115 bool u1 = uses_template_parms (type1);
3116 bool u2 = type2 ? uses_template_parms (type2) : false;
3117 if (u1 || u2)
3118 {
3119 /* Try to recover if one of the types is non-dependent. But if
3120 there's only one type, there's nothing we can do. */
3121 if (!type2)
3122 return;
3123 /* And we lose if both are dependent. */
3124 if (u1 && u2)
3125 return;
3126 /* Or if they have different forms. */
3127 if (TREE_CODE (type1)((enum tree_code) (type1)->base.code) != TREE_CODE (type2)((enum tree_code) (type2)->base.code))
3128 return;
3129
3130 if (u1 && !u2)
3131 type1 = type2;
3132 else if (u2 && !u1)
3133 type2 = type1;
3134 }
3135
3136 /* If we're dealing with two pointer types or two enumeral types,
3137 we need candidates for both of them. */
3138 if (type2 && !same_type_p (type1, type2)comptypes ((type1), (type2), 0)
3139 && TREE_CODE (type1)((enum tree_code) (type1)->base.code) == TREE_CODE (type2)((enum tree_code) (type2)->base.code)
3140 && (TYPE_REF_P (type1)(((enum tree_code) (type1)->base.code) == REFERENCE_TYPE)
3141 || (TYPE_PTR_P (type1)(((enum tree_code) (type1)->base.code) == POINTER_TYPE) && TYPE_PTR_P (type2)(((enum tree_code) (type2)->base.code) == POINTER_TYPE))
3142 || (TYPE_PTRDATAMEM_P (type1)(((enum tree_code) (type1)->base.code) == OFFSET_TYPE) && TYPE_PTRDATAMEM_P (type2)(((enum tree_code) (type2)->base.code) == OFFSET_TYPE))
3143 || TYPE_PTRMEMFUNC_P (type1)(((enum tree_code) (type1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3143, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3143, __FUNCTION__))->type_common.lang_flag_2)))
3144 || MAYBE_CLASS_TYPE_P (type1)((((enum tree_code) (type1)->base.code) == TEMPLATE_TYPE_PARM
|| ((enum tree_code) (type1)->base.code) == TYPENAME_TYPE
|| ((enum tree_code) (type1)->base.code) == TYPEOF_TYPE ||
((enum tree_code) (type1)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (type1)->base.code) == DECLTYPE_TYPE
) || (((((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/call.c"
, 3144, __FUNCTION__))->type_common.lang_flag_5)))
3145 || TREE_CODE (type1)((enum tree_code) (type1)->base.code) == ENUMERAL_TYPE))
3146 {
3147 if (TYPE_PTR_OR_PTRMEM_P (type1)((((enum tree_code) (type1)->base.code) == POINTER_TYPE) ||
((((enum tree_code) (type1)->base.code) == OFFSET_TYPE) ||
(((enum tree_code) (type1)->base.code) == RECORD_TYPE &&
(((tree_class_check (((tree_check ((type1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3147, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3147, __FUNCTION__))->type_common.lang_flag_2)))))
)
3148 {
3149 tree cptype = composite_pointer_type (input_location,
3150 type1, type2,
3151 error_mark_nodeglobal_trees[TI_ERROR_MARK],
3152 error_mark_nodeglobal_trees[TI_ERROR_MARK],
3153 CPO_CONVERSION,
3154 tf_none);
3155 if (cptype != error_mark_nodeglobal_trees[TI_ERROR_MARK])
3156 {
3157 build_builtin_candidate
3158 (candidates, fnname, cptype, cptype, args, argtypes,
3159 flags, complain);
3160 return;
3161 }
3162 }
3163
3164 build_builtin_candidate
3165 (candidates, fnname, type1, type1, args, argtypes, flags, complain);
3166 build_builtin_candidate
3167 (candidates, fnname, type2, type2, args, argtypes, flags, complain);
3168 return;
3169 }
3170
3171 build_builtin_candidate
3172 (candidates, fnname, type1, type2, args, argtypes, flags, complain);
3173}
3174
3175tree
3176type_decays_to (tree type)
3177{
3178 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == ARRAY_TYPE)
3179 return 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/call.c"
, 3179, __FUNCTION__))->typed.type)
);
3180 if (TREE_CODE (type)((enum tree_code) (type)->base.code) == FUNCTION_TYPE)
3181 return build_pointer_type (type);
3182 return type;
3183}
3184
3185/* There are three conditions of builtin candidates:
3186
3187 1) bool-taking candidates. These are the same regardless of the input.
3188 2) pointer-pair taking candidates. These are generated for each type
3189 one of the input types converts to.
3190 3) arithmetic candidates. According to the standard, we should generate
3191 all of these, but I'm trying not to...
3192
3193 Here we generate a superset of the possible candidates for this particular
3194 case. That is a subset of the full set the standard defines, plus some
3195 other cases which the standard disallows. add_builtin_candidate will
3196 filter out the invalid set. */
3197
3198static void
3199add_builtin_candidates (struct z_candidate **candidates, enum tree_code code,
3200 enum tree_code code2, tree fnname,
3201 vec<tree, va_gc> *argv,
3202 int flags, tsubst_flags_t complain)
3203{
3204 int ref1;
3205 int enum_p = 0;
3206 tree type, argtypes[3], t;
3207 /* TYPES[i] is the set of possible builtin-operator parameter types
3208 we will consider for the Ith argument. */
3209 vec<tree, va_gc> *types[2];
3210 unsigned ix;
3211 vec<tree, va_gc> &args = *argv;
3212 unsigned len = args.length ();
3213
3214 for (unsigned i = 0; i < len; ++i)
3215 {
3216 if (args[i])
3217 argtypes[i] = unlowered_expr_type (args[i]);
3218 else
3219 argtypes[i] = NULL_TREE(tree) __null;
3220 }
3221
3222 switch (code)
3223 {
3224/* 4 For every pair T, VQ), where T is an arithmetic or enumeration type,
3225 and VQ is either volatile or empty, there exist candidate operator
3226 functions of the form
3227 VQ T& operator++(VQ T&); */
3228
3229 case POSTINCREMENT_EXPR:
3230 case PREINCREMENT_EXPR:
3231 case POSTDECREMENT_EXPR:
3232 case PREDECREMENT_EXPR:
3233 case MODIFY_EXPR:
3234 ref1 = 1;
3235 break;
3236
3237/* 24There also exist candidate operator functions of the form
3238 bool operator!(bool);
3239 bool operator&&(bool, bool);
3240 bool operator||(bool, bool); */
3241
3242 case TRUTH_NOT_EXPR:
3243 build_builtin_candidate
3244 (candidates, fnname, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE],
3245 NULL_TREE(tree) __null, args, argtypes, flags, complain);
3246 return;
3247
3248 case TRUTH_ORIF_EXPR:
3249 case TRUTH_ANDIF_EXPR:
3250 build_builtin_candidate
3251 (candidates, fnname, boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE],
3252 boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], args, argtypes, flags, complain);
3253 return;
3254
3255 case ADDR_EXPR:
3256 case COMPOUND_EXPR:
3257 case COMPONENT_REF:
3258 case CO_AWAIT_EXPR:
3259 return;
3260
3261 case COND_EXPR:
3262 case EQ_EXPR:
3263 case NE_EXPR:
3264 case LT_EXPR:
3265 case LE_EXPR:
3266 case GT_EXPR:
3267 case GE_EXPR:
3268 case SPACESHIP_EXPR:
3269 enum_p = 1;
3270 /* Fall through. */
3271
3272 default:
3273 ref1 = 0;
3274 }
3275
3276 types[0] = make_tree_vector ();
3277 types[1] = make_tree_vector ();
3278
3279 if (len == 3)
3280 len = 2;
3281 for (unsigned i = 0; i < len; ++i)
3282 {
3283 if (MAYBE_CLASS_TYPE_P (argtypes[i])((((enum tree_code) (argtypes[i])->base.code) == TEMPLATE_TYPE_PARM
|| ((enum tree_code) (argtypes[i])->base.code) == TYPENAME_TYPE
|| ((enum tree_code) (argtypes[i])->base.code) == TYPEOF_TYPE
|| ((enum tree_code) (argtypes[i])->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (argtypes[i])->base.code) == DECLTYPE_TYPE
) || (((((enum tree_code) (argtypes[i])->base.code)) == RECORD_TYPE
|| (((enum tree_code) (argtypes[i])->base.code)) == UNION_TYPE
) && ((tree_class_check ((argtypes[i]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3283, __FUNCTION__))->type_common.lang_flag_5)))
)
3284 {
3285 tree convs;
3286
3287 if (i == 0 && code == MODIFY_EXPR && code2 == NOP_EXPR)
3288 return;
3289
3290 convs = lookup_conversions (argtypes[i]);
3291
3292 if (code == COND_EXPR)
3293 {
3294 if (lvalue_p (args[i]))
3295 vec_safe_push (types[i], build_reference_type (argtypes[i]));
3296
3297 vec_safe_push (types[i], TYPE_MAIN_VARIANT (argtypes[i])((tree_class_check ((argtypes[i]), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3297, __FUNCTION__))->type_common.main_variant)
);
3298 }
3299
3300 else if (! convs)
3301 return;
3302
3303 for (; convs; convs = TREE_CHAIN (convs)((contains_struct_check ((convs), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3303, __FUNCTION__))->common.chain)
)
3304 {
3305 type = TREE_TYPE (convs)((contains_struct_check ((convs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3305, __FUNCTION__))->typed.type)
;
3306
3307 if (i == 0 && ref1
3308 && (!TYPE_REF_P (type)(((enum tree_code) (type)->base.code) == REFERENCE_TYPE)
3309 || CP_TYPE_CONST_P (TREE_TYPE (type))((cp_type_quals (((contains_struct_check ((type), (TS_TYPED),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3309, __FUNCTION__))->typed.type)) & TYPE_QUAL_CONST
) != 0)
))
3310 continue;
3311
3312 if (code == COND_EXPR && TYPE_REF_P (type)(((enum tree_code) (type)->base.code) == REFERENCE_TYPE))
3313 vec_safe_push (types[i], type);
3314
3315 type = non_reference (type);
3316 if (i != 0 || ! ref1)
3317 {
3318 type = cv_unqualified (type_decays_to (type));
3319 if (enum_p && TREE_CODE (type)((enum tree_code) (type)->base.code) == ENUMERAL_TYPE)
3320 vec_safe_push (types[i], type);
3321 if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_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/call.c"
, 3321, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type)->base.code) == INTEGER_TYPE))
)
3322 type = type_promotes_to (type);
3323 }
3324
3325 if (! vec_member (type, types[i]))
3326 vec_safe_push (types[i], type);
3327 }
3328 }
3329 else
3330 {
3331 if (code == COND_EXPR && lvalue_p (args[i]))
3332 vec_safe_push (types[i], build_reference_type (argtypes[i]));
3333 type = non_reference (argtypes[i]);
3334 if (i != 0 || ! ref1)
3335 {
3336 type = cv_unqualified (type_decays_to (type));
3337 if (enum_p && UNSCOPED_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/call.c"
, 3337, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
)
)
3338 vec_safe_push (types[i], type);
3339 if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_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/call.c"
, 3339, __FUNCTION__, (ENUMERAL_TYPE)))->base.static_flag)
) || (((enum tree_code) (type)->base.code) == BOOLEAN_TYPE
|| ((enum tree_code) (type)->base.code) == INTEGER_TYPE))
)
3340 type = type_promotes_to (type);
3341 }
3342 vec_safe_push (types[i], type);
3343 }
3344 }
3345
3346 /* Run through the possible parameter types of both arguments,
3347 creating candidates with those parameter types. */
3348 FOR_EACH_VEC_ELT_REVERSE (*(types[0]), ix, t)for (ix = (*(types[0])).length () - 1; (*(types[0])).iterate (
(ix), &(t)); (ix)--)
3349 {
3350 unsigned jx;
3351 tree u;
3352
3353 if (!types[1]->is_empty ())
3354 FOR_EACH_VEC_ELT_REVERSE (*(types[1]), jx, u)for (jx = (*(types[1])).length () - 1; (*(types[1])).iterate (
(jx), &(u)); (jx)--)
3355 add_builtin_candidate
3356 (candidates, code, code2, fnname, t,
3357 u, args, argtypes, flags, complain);
3358 else
3359 add_builtin_candidate
3360 (candidates, code, code2, fnname, t,
3361 NULL_TREE(tree) __null, args, argtypes, flags, complain);
3362 }
3363
3364 release_tree_vector (types[0]);
3365 release_tree_vector (types[1]);
3366}
3367
3368
3369/* If TMPL can be successfully instantiated as indicated by
3370 EXPLICIT_TARGS and ARGLIST, adds the instantiation to CANDIDATES.
3371
3372 TMPL is the template. EXPLICIT_TARGS are any explicit template
3373 arguments. ARGLIST is the arguments provided at the call-site.
3374 This does not change ARGLIST. The RETURN_TYPE is the desired type
3375 for conversion operators. If OBJ is NULL_TREE, FLAGS and CTYPE are
3376 as for add_function_candidate. If an OBJ is supplied, FLAGS and
3377 CTYPE are ignored, and OBJ is as for add_conv_candidate.
3378
3379 SHORTCUT_BAD_CONVS is as in add_function_candidate. */
3380
3381static struct z_candidate*
3382add_template_candidate_real (struct z_candidate **candidates, tree tmpl,
3383 tree ctype, tree explicit_targs, tree first_arg,
3384 const vec<tree, va_gc> *arglist, tree return_type,
3385 tree access_path, tree conversion_path,
3386 int flags, tree obj, unification_kind_t strict,
3387 bool shortcut_bad_convs, tsubst_flags_t complain)
3388{
3389 int ntparms = DECL_NTPARMS (tmpl)((tree_check ((((tree_check ((((struct tree_template_decl *)(
const_cast<union tree_node *> ((((tree_check ((tmpl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3389, __FUNCTION__, (TEMPLATE_DECL))))))))->arguments), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3389, __FUNCTION__, (TREE_LIST)))->list.value)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3389, __FUNCTION__, (TREE_VEC)))->base.u.length)
;
3390 tree targs = make_tree_vec (ntparms);
3391 unsigned int len = vec_safe_length (arglist);
3392 unsigned int nargs = (first_arg == NULL_TREE(tree) __null ? 0 : 1) + len;
3393 unsigned int skip_without_in_chrg = 0;
3394 tree first_arg_without_in_chrg = first_arg;
3395 tree *args_without_in_chrg;
3396 unsigned int nargs_without_in_chrg;
3397 unsigned int ia, ix;
3398 tree arg;
3399 struct z_candidate *cand;
3400 tree fn;
3401 struct rejection_reason *reason = NULL__null;
3402 int errs;
3403 conversion **convs = NULL__null;
3404
3405 /* We don't do deduction on the in-charge parameter, the VTT
3406 parameter or 'this'. */
3407 if (DECL_NONSTATIC_MEMBER_FUNCTION_P (tmpl)(((enum tree_code) (((contains_struct_check ((tmpl), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3407, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)
)
3408 {
3409 if (first_arg_without_in_chrg != NULL_TREE(tree) __null)
3410 first_arg_without_in_chrg = NULL_TREE(tree) __null;
3411 else if (return_type && strict == DEDUCE_CALL)
3412 /* We're deducing for a call to the result of a template conversion
3413 function, so the args don't contain 'this'; leave them alone. */;
3414 else
3415 ++skip_without_in_chrg;
3416 }
3417
3418 if ((DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (tmpl)(((contains_struct_check ((tmpl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3418, __FUNCTION__))->decl_minimal.name) == cp_global_trees
[CPTI_CTOR_IDENTIFIER])
3419 || DECL_BASE_CONSTRUCTOR_P (tmpl)(((contains_struct_check ((tmpl), (TS_DECL_MINIMAL), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3419, __FUNCTION__))->decl_minimal.name) == cp_global_trees
[CPTI_BASE_CTOR_IDENTIFIER])
)
3420 && CLASSTYPE_VBASECLASSES (DECL_CONTEXT (tmpl))((((tree_class_check ((((contains_struct_check ((tmpl), (TS_DECL_MINIMAL
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3420, __FUNCTION__))->decl_minimal.context)), (tcc_type)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3420, __FUNCTION__))->type_with_lang_specific.lang_specific
))->vbases)
)
3421 {
3422 if (first_arg_without_in_chrg != NULL_TREE(tree) __null)
3423 first_arg_without_in_chrg = NULL_TREE(tree) __null;
3424 else
3425 ++skip_without_in_chrg;
3426 }
3427
3428 if (len < skip_without_in_chrg)
3429 return NULL__null;
3430
3431 if (DECL_CONSTRUCTOR_P (tmpl)((tree_check (((((enum tree_code) (tmpl)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((tmpl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3431, __FUNCTION__, (TEMPLATE_DECL))))))))->result : tmpl
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3431, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
&& nargs == 2
3432 && same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (first_arg)((contains_struct_check ((first_arg), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3432, __FUNCTION__))->typed.type)
,
3433 TREE_TYPE ((*arglist)[0])((contains_struct_check (((*arglist)[0]), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3433, __FUNCTION__))->typed.type)
))
3434 {
3435 /* 12.8/6 says, "A declaration of a constructor for a class X is
3436 ill-formed if its first parameter is of type (optionally cv-qualified)
3437 X and either there are no other parameters or else all other
3438 parameters have default arguments. A member function template is never
3439 instantiated to produce such a constructor signature."
3440
3441 So if we're trying to copy an object of the containing class, don't
3442 consider a template constructor that has a first parameter type that
3443 is just a template parameter, as we would deduce a signature that we
3444 would then reject in the code below. */
3445 if (tree firstparm = FUNCTION_FIRST_USER_PARMTYPE (tmpl)skip_artificial_parms_for ((tmpl), ((tree_check2 ((((contains_struct_check
((tmpl), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3445, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3445, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values))
)
3446 {
3447 firstparm = TREE_VALUE (firstparm)((tree_check ((firstparm), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3447, __FUNCTION__, (TREE_LIST)))->list.value)
;
3448 if (PACK_EXPANSION_P (firstparm)(((enum tree_code) (firstparm)->base.code) == TYPE_PACK_EXPANSION
|| ((enum tree_code) (firstparm)->base.code) == EXPR_PACK_EXPANSION
)
)
3449 firstparm = PACK_EXPANSION_PATTERN (firstparm)(((enum tree_code) (firstparm)->base.code) == TYPE_PACK_EXPANSION
? ((contains_struct_check ((firstparm), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3449, __FUNCTION__))->typed.type) : (*((const_cast<tree
*> (tree_operand_check ((firstparm), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3449, __FUNCTION__))))))
;
3450 if (TREE_CODE (firstparm)((enum tree_code) (firstparm)->base.code) == TEMPLATE_TYPE_PARM)
3451 {
3452 gcc_assert (!explicit_targs)((void)(!(!explicit_targs) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3452, __FUNCTION__), 0 : 0))
;
3453 reason = invalid_copy_with_fn_template_rejection ();
3454 goto fail;
3455 }
3456 }
3457 }
3458
3459 nargs_without_in_chrg = ((first_arg_without_in_chrg != NULL_TREE(tree) __null ? 1 : 0)
3460 + (len - skip_without_in_chrg));
3461 args_without_in_chrg = XALLOCAVEC (tree, nargs_without_in_chrg)((tree *) __builtin_alloca(sizeof (tree) * (nargs_without_in_chrg
)))
;
3462 ia = 0;
3463 if (first_arg_without_in_chrg != NULL_TREE(tree) __null)
3464 {
3465 args_without_in_chrg[ia] = first_arg_without_in_chrg;
3466 ++ia;
3467 }
3468 for (ix = skip_without_in_chrg;
3469 vec_safe_iterate (arglist, ix, &arg);
3470 ++ix)
3471 {
3472 args_without_in_chrg[ia] = arg;
3473 ++ia;
3474 }
3475 gcc_assert (ia == nargs_without_in_chrg)((void)(!(ia == nargs_without_in_chrg) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3475, __FUNCTION__), 0 : 0))
;
3476
3477 if (!obj && explicit_targs)
3478 {
3479 /* Check that there's no obvious arity mismatch before proceeding with
3480 deduction. This avoids substituting explicit template arguments
3481 into the template (which could result in an error outside the
3482 immediate context) when the resulting candidate would be unviable
3483 anyway. */
3484 int min_arity = 0, max_arity = 0;
3485 tree parms = TYPE_ARG_TYPES (TREE_TYPE (tmpl))((tree_check2 ((((contains_struct_check ((tmpl), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3485, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3485, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)
;
3486 parms = skip_artificial_parms_for (tmpl, parms);
3487 for (; parms != void_list_nodeglobal_trees[TI_VOID_LIST_NODE]; parms = TREE_CHAIN (parms)((contains_struct_check ((parms), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3487, __FUNCTION__))->common.chain)
)
3488 {
3489 if (!parms || PACK_EXPANSION_P (TREE_VALUE (parms))(((enum tree_code) (((tree_check ((parms), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3489, __FUNCTION__, (TREE_LIST)))->list.value))->base
.code) == TYPE_PACK_EXPANSION || ((enum tree_code) (((tree_check
((parms), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3489, __FUNCTION__, (TREE_LIST)))->list.value))->base
.code) == EXPR_PACK_EXPANSION)
)
3490 {
3491 max_arity = -1;
3492 break;
3493 }
3494 if (TREE_PURPOSE (parms)((tree_check ((parms), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3494, __FUNCTION__, (TREE_LIST)))->list.purpose)
)
3495 /* A parameter with a default argument. */
3496 ++max_arity;
3497 else
3498 ++min_arity, ++max_arity;
3499 }
3500 if (ia < (unsigned)min_arity)
3501 {
3502 /* Too few arguments. */
3503 reason = arity_rejection (NULL_TREE(tree) __null, min_arity, ia,
3504 /*least_p=*/(max_arity == -1));
3505 goto fail;
3506 }
3507 else if (max_arity != -1 && ia > (unsigned)max_arity)
3508 {
3509 /* Too many arguments. */
3510 reason = arity_rejection (NULL_TREE(tree) __null, max_arity, ia);
3511 goto fail;
3512 }
3513 }
3514
3515 errs = errorcount(global_dc)->diagnostic_count[(int) (DK_ERROR)]+sorrycount(global_dc)->diagnostic_count[(int) (DK_SORRY)];
3516 if (!obj)
3517 {
3518 convs = alloc_conversions (nargs);
3519
3520 if (shortcut_bad_convs
3521 && DECL_NONSTATIC_MEMBER_FUNCTION_P (tmpl)(((enum tree_code) (((contains_struct_check ((tmpl), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3521, __FUNCTION__))->typed.type))->base.code) == METHOD_TYPE
)
3522 && !DECL_CONSTRUCTOR_P (tmpl)((tree_check (((((enum tree_code) (tmpl)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((tmpl), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3522, __FUNCTION__, (TEMPLATE_DECL))))))))->result : tmpl
)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3522, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
3523 {
3524 /* Check the 'this' conversion before proceeding with deduction.
3525 This is effectively an extension of the DR 1391 resolution
3526 that we perform in check_non_deducible_conversions, though it's
3527 convenient to do this extra check here instead of there. */
3528 tree parmtype = TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (tmpl)))((tree_check ((((tree_check2 ((((contains_struct_check ((tmpl
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3528, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3528, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3528, __FUNCTION__, (TREE_LIST)))->list.value)
;
3529 tree argtype = lvalue_type (first_arg);
3530 tree arg = first_arg;
3531 conversion *t = build_this_conversion (tmpl, ctype,
3532 parmtype, argtype, arg,
3533 flags, complain);
3534 convs[0] = t;
3535 if (t->bad_p)
3536 {
3537 reason = bad_arg_conversion_rejection (first_arg, 0,
3538 arg, parmtype,
3539 EXPR_LOCATION (arg)((((arg)) && ((tree_code_type[(int) (((enum tree_code
) ((arg))->base.code))]) >= tcc_reference && (tree_code_type
[(int) (((enum tree_code) ((arg))->base.code))]) <= tcc_expression
)) ? (arg)->exp.locus : ((location_t) 0))
);
3540 goto fail;
3541 }
3542 }
3543 }
3544 fn = fn_type_unification (tmpl, explicit_targs, targs,
3545 args_without_in_chrg,
3546 nargs_without_in_chrg,
3547 return_type, strict, flags, convs,
3548 false, complain & tf_decltype);
3549
3550 if (fn == error_mark_nodeglobal_trees[TI_ERROR_MARK])
3551 {
3552 /* Don't repeat unification later if it already resulted in errors. */
3553 if (errorcount(global_dc)->diagnostic_count[(int) (DK_ERROR)]+sorrycount(global_dc)->diagnostic_count[(int) (DK_SORRY)] == errs)
3554 reason = template_unification_rejection (tmpl, explicit_targs,
3555 targs, args_without_in_chrg,
3556 nargs_without_in_chrg,
3557 return_type, strict, flags);
3558 else
3559 reason = template_unification_error_rejection ();
3560 goto fail;
3561 }
3562
3563 /* Now the explicit specifier might have been deduced; check if this
3564 declaration is explicit. If it is and we're ignoring non-converting
3565 constructors, don't add this function to the set of candidates. */
3566 if ((flags & LOOKUP_ONLYCONVERTING(1 << 2)) && DECL_NONCONVERTING_P (fn)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? (
(struct tree_template_decl *)(const_cast<union tree_node *
> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3566, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3566, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (fn)->base.code) == FUNCTION_DECL || (((
enum tree_code) (fn)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3566, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3566, __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/call.c"
, 3566, __FUNCTION__); &lt->u.fn; })->nonconverting
)
)
3567 return NULL__null;
3568
3569 if (DECL_CONSTRUCTOR_P (fn)((tree_check (((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3569, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3569, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
&& nargs == 2)
3570 {
3571 tree arg_types = FUNCTION_FIRST_USER_PARMTYPE (fn)skip_artificial_parms_for ((fn), ((tree_check2 ((((contains_struct_check
((fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3571, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3571, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values))
;
3572 if (arg_types && same_type_p (TYPE_MAIN_VARIANT (TREE_VALUE (arg_types)),comptypes ((((tree_class_check ((((tree_check ((arg_types), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3572, __FUNCTION__, (TREE_LIST)))->list.value)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3572, __FUNCTION__))->type_common.main_variant)), (ctype
), 0)
3573 ctype)comptypes ((((tree_class_check ((((tree_check ((arg_types), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3572, __FUNCTION__, (TREE_LIST)))->list.value)), (tcc_type
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3572, __FUNCTION__))->type_common.main_variant)), (ctype
), 0)
)
3574 {
3575 /* We're trying to produce a constructor with a prohibited signature,
3576 as discussed above; handle here any cases we didn't catch then,
3577 such as X(X<T>). */
3578 reason = invalid_copy_with_fn_template_rejection ();
3579 goto fail;
3580 }
3581 }
3582
3583 if (obj != NULL_TREE(tree) __null)
3584 /* Aha, this is a conversion function. */
3585 cand = add_conv_candidate (candidates, fn, obj, arglist,
3586 access_path, conversion_path, complain);
3587 else
3588 cand = add_function_candidate (candidates, fn, ctype,
3589 first_arg, arglist, access_path,
3590 conversion_path, flags, convs,
3591 shortcut_bad_convs, complain);
3592 if (DECL_TI_TEMPLATE (fn)((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/call.c"
, 3592, __FUNCTION__)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3592, __FUNCTION__))->decl_common.lang_specific) ->u.
min.template_info)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3592, __FUNCTION__, (TEMPLATE_INFO))))->tmpl
!= tmpl)
3593 /* This situation can occur if a member template of a template
3594 class is specialized. Then, instantiate_template might return
3595 an instantiation of the specialization, in which case the
3596 DECL_TI_TEMPLATE field will point at the original
3597 specialization. For example:
3598
3599 template <class T> struct S { template <class U> void f(U);
3600 template <> void f(int) {}; };
3601 S<double> sd;
3602 sd.f(3);
3603
3604 Here, TMPL will be template <class U> S<double>::f(U).
3605 And, instantiate template will give us the specialization
3606 template <> S<double>::f(int). But, the DECL_TI_TEMPLATE field
3607 for this will point at template <class T> template <> S<T>::f(int),
3608 so that we can find the definition. For the purposes of
3609 overload resolution, however, we want the original TMPL. */
3610 cand->template_decl = build_template_info (tmpl, targs);
3611 else
3612 cand->template_decl = DECL_TEMPLATE_INFO (fn)(((contains_struct_check ((template_info_decl_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3612, __FUNCTION__)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3612, __FUNCTION__))->decl_common.lang_specific) ->u.
min.template_info)
;
3613 cand->explicit_targs = explicit_targs;
3614
3615 return cand;
3616 fail:
3617 int viable = (reason->code == rr_bad_arg_conversion ? -1 : 0);
3618 return add_candidate (candidates, tmpl, first_arg, arglist, nargs, convs,
3619 access_path, conversion_path, viable, reason, flags);
3620}
3621
3622
3623static struct z_candidate *
3624add_template_candidate (struct z_candidate **candidates, tree tmpl, tree ctype,
3625 tree explicit_targs, tree first_arg,
3626 const vec<tree, va_gc> *arglist, tree return_type,
3627 tree access_path, tree conversion_path, int flags,
3628 unification_kind_t strict, bool shortcut_bad_convs,
3629 tsubst_flags_t complain)
3630{
3631 return
3632 add_template_candidate_real (candidates, tmpl, ctype,
3633 explicit_targs, first_arg, arglist,
3634 return_type, access_path, conversion_path,
3635 flags, NULL_TREE(tree) __null, strict, shortcut_bad_convs,
3636 complain);
3637}
3638
3639/* Create an overload candidate for the conversion function template TMPL,
3640 returning RETURN_TYPE, which will be invoked for expression OBJ to produce a
3641 pointer-to-function which will in turn be called with the argument list
3642 ARGLIST, and add it to CANDIDATES. This does not change ARGLIST. FLAGS is
3643 passed on to implicit_conversion. */
3644
3645static struct z_candidate *
3646add_template_conv_candidate (struct z_candidate **candidates, tree tmpl,
3647 tree obj,
3648 const vec<tree, va_gc> *arglist,
3649 tree return_type, tree access_path,
3650 tree conversion_path, tsubst_flags_t complain)
3651{
3652 /* Making this work broke PR 71117 and 85118, so until the committee resolves
3653 core issue 2189, let's disable this candidate if there are any call
3654 operators. */
3655 if (*candidates)
3656 return NULL__null;
3657
3658 return
3659 add_template_candidate_real (candidates, tmpl, NULL_TREE(tree) __null, NULL_TREE(tree) __null,
3660 NULL_TREE(tree) __null, arglist, return_type, access_path,
3661 conversion_path, 0, obj, DEDUCE_CALL,
3662 /*shortcut_bad_convs=*/false, complain);
3663}
3664
3665/* The CANDS are the set of candidates that were considered for
3666 overload resolution. Return the set of viable candidates, or CANDS
3667 if none are viable. If any of the candidates were viable, set
3668 *ANY_VIABLE_P to true. STRICT_P is true if a candidate should be
3669 considered viable only if it is strictly viable. */
3670
3671static struct z_candidate*
3672splice_viable (struct z_candidate *cands,
3673 bool strict_p,
3674 bool *any_viable_p)
3675{
3676 struct z_candidate *viable;
3677 struct z_candidate **last_viable;
3678 struct z_candidate **cand;
3679 bool found_strictly_viable = false;
3680
3681 /* Be strict inside templates, since build_over_call won't actually
3682 do the conversions to get pedwarns. */
3683 if (processing_template_declscope_chain->x_processing_template_decl)
3684 strict_p = true;
3685
3686 viable = NULL__null;
3687 last_viable = &viable;
3688 *any_viable_p = false;
3689
3690 cand = &cands;
3691 while (*cand)
3692 {
3693 struct z_candidate *c = *cand;
3694 if (!strict_p
3695 && (c->viable == 1 || TREE_CODE (c->fn)((enum tree_code) (c->fn)->base.code) == TEMPLATE_DECL))
3696 {
3697 /* Be strict in the presence of a viable candidate. Also if
3698 there are template candidates, so that we get deduction errors
3699 for them instead of silently preferring a bad conversion. */
3700 strict_p = true;
3701 if (viable && !found_strictly_viable)
3702 {
3703 /* Put any spliced near matches back onto the main list so
3704 that we see them if there is no strict match. */
3705 *any_viable_p = false;
3706 *last_viable = cands;
3707 cands = viable;
3708 viable = NULL__null;
3709 last_viable = &viable;
3710 }
3711 }
3712
3713 if (strict_p ? c->viable == 1 : c->viable)
3714 {
3715 *last_viable = c;
3716 *cand = c->next;
3717 c->next = NULL__null;
3718 last_viable = &c->next;
3719 *any_viable_p = true;
3720 if (c->viable == 1)
3721 found_strictly_viable = true;
3722 }
3723 else
3724 cand = &c->next;
3725 }
3726
3727 return viable ? viable : cands;
3728}
3729
3730static bool
3731any_strictly_viable (struct z_candidate *cands)
3732{
3733 for (; cands; cands = cands->next)
3734 if (cands->viable == 1)
3735 return true;
3736 return false;
3737}
3738
3739/* OBJ is being used in an expression like "OBJ.f (...)". In other
3740 words, it is about to become the "this" pointer for a member
3741 function call. Take the address of the object. */
3742
3743static tree
3744build_this (tree obj)
3745{
3746 /* In a template, we are only concerned about the type of the
3747 expression, so we can take a shortcut. */
3748 if (processing_template_declscope_chain->x_processing_template_decl)
3749 return build_address (obj);
3750
3751 return cp_build_addr_expr (obj, tf_warning_or_error);
3752}
3753
3754/* Returns true iff functions are equivalent. Equivalent functions are
3755 not '==' only if one is a function-local extern function or if
3756 both are extern "C". */
3757
3758static inline int
3759equal_functions (tree fn1, tree fn2)
3760{
3761 if (TREE_CODE (fn1)((enum tree_code) (fn1)->base.code) != TREE_CODE (fn2)((enum tree_code) (fn2)->base.code))
3762 return 0;
3763 if (TREE_CODE (fn1)((enum tree_code) (fn1)->base.code) == TEMPLATE_DECL)
3764 return fn1 == fn2;
3765 if (DECL_LOCAL_DECL_P (fn1)((contains_struct_check (((tree_check2 ((fn1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3765, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3765, __FUNCTION__))->decl_common.lang_flag_0)
|| DECL_LOCAL_DECL_P (fn2)((contains_struct_check (((tree_check2 ((fn2), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3765, __FUNCTION__, (VAR_DECL), (FUNCTION_DECL)))), (TS_DECL_COMMON
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3765, __FUNCTION__))->decl_common.lang_flag_0)
3766 || DECL_EXTERN_C_FUNCTION_P (fn1)((((enum tree_code) (fn1)->base.code) == FUNCTION_DECL &&
!(((enum tree_code) (fn1)->base.code) == FUNCTION_DECL &&
((contains_struct_check ((fn1), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3766, __FUNCTION__))->decl_common.lang_specific) &&
__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (fn1)->base.code) == TEMPLATE_DECL ?
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3766, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn1
)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3766, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (fn1)->base.code) == FUNCTION_DECL || ((
(enum tree_code) (fn1)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3766, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn1)
, "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3766, __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/call.c"
, 3766, __FUNCTION__); &lt->u.fn; })->thunk_p)) &&
((((contains_struct_check ((fn1), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3766, __FUNCTION__))->decl_common.lang_specific) ? ((contains_struct_check
((fn1), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3766, __FUNCTION__))->decl_common.lang_specific)->u.base
.language : (((enum tree_code) (fn1)->base.code) == FUNCTION_DECL
? lang_c : lang_cplusplus)) == lang_c))
)
3767 return decls_match (fn1, fn2);
3768 return fn1 == fn2;
3769}
3770
3771/* Print information about a candidate FN being rejected due to INFO. */
3772
3773static void
3774print_conversion_rejection (location_t loc, struct conversion_info *info,
3775 tree fn)
3776{
3777 tree from = info->from;
3778 if (!TYPE_P (from)(tree_code_type[(int) (((enum tree_code) (from)->base.code
))] == tcc_type)
)
3779 from = lvalue_type (from);
3780 if (info->n_arg == -1)
3781 {
3782 /* Conversion of implicit `this' argument failed. */
3783 if (!TYPE_P (info->from)(tree_code_type[(int) (((enum tree_code) (info->from)->
base.code))] == tcc_type)
)
3784 /* A bad conversion for 'this' must be discarding cv-quals. */
3785 inform (loc, " passing %qT as %<this%> "
3786 "argument discards qualifiers",
3787 from);
3788 else
3789 inform (loc, " no known conversion for implicit "
3790 "%<this%> parameter from %qH to %qI",
3791 from, info->to_type);
3792 }
3793 else if (!TYPE_P (info->from)(tree_code_type[(int) (((enum tree_code) (info->from)->
base.code))] == tcc_type)
)
3794 {
3795 if (info->n_arg >= 0)
3796 inform (loc, " conversion of argument %d would be ill-formed:",
3797 info->n_arg + 1);
3798 perform_implicit_conversion (info->to_type, info->from,
3799 tf_warning_or_error);
3800 }
3801 else if (info->n_arg == -2)
3802 /* Conversion of conversion function return value failed. */
3803 inform (loc, " no known conversion from %qH to %qI",
3804 from, info->to_type);
3805 else
3806 {
3807 if (TREE_CODE (fn)((enum tree_code) (fn)->base.code) == FUNCTION_DECL)
3808 loc = get_fndecl_argument_location (fn, info->n_arg);
3809 inform (loc, " no known conversion for argument %d from %qH to %qI",
3810 info->n_arg + 1, from, info->to_type);
3811 }
3812}
3813
3814/* Print information about a candidate with WANT parameters and we found
3815 HAVE. */
3816
3817static void
3818print_arity_information (location_t loc, unsigned int have, unsigned int want,
3819 bool least_p)
3820{
3821 if (least_p)
3822 inform_n (loc, want,
3823 " candidate expects at least %d argument, %d provided",
3824 " candidate expects at least %d arguments, %d provided",
3825 want, have);
3826 else
3827 inform_n (loc, want,
3828 " candidate expects %d argument, %d provided",
3829 " candidate expects %d arguments, %d provided",
3830 want, have);
3831}
3832
3833/* Print information about one overload candidate CANDIDATE. MSGSTR
3834 is the text to print before the candidate itself.
3835
3836 NOTE: Unlike most diagnostic functions in GCC, MSGSTR is expected
3837 to have been run through gettext by the caller. This wart makes
3838 life simpler in print_z_candidates and for the translators. */
3839
3840static void
3841print_z_candidate (location_t loc, const char *msgstr,
3842 struct z_candidate *candidate)
3843{
3844 const char *msg = (msgstr == NULL__null
3845 ? ""
3846 : ACONCAT ((_(msgstr), " ", NULL))(libiberty_concat_ptr = (char *) __builtin_alloca(concat_length
(gettext (msgstr), " ", __null) + 1), concat_copy2 (gettext (
msgstr), " ", __null))
);
3847 tree fn = candidate->fn;
3848 if (flag_new_inheriting_ctorsglobal_options.x_flag_new_inheriting_ctors)
3849 fn = strip_inheriting_ctors (fn);
3850 location_t cloc = location_of (fn);
3851
3852 if (identifier_p (fn))
3853 {
3854 cloc = loc;
3855 if (candidate->num_convs == 3)
3856 inform (cloc, "%s%<%D(%T, %T, %T)%> (built-in)", msg, fn,
3857 candidate->convs[0]->type,
3858 candidate->convs[1]->type,
3859 candidate->convs[2]->type);
3860 else if (candidate->num_convs == 2)
3861 inform (cloc, "%s%<%D(%T, %T)%> (built-in)", msg, fn,
3862 candidate->convs[0]->type,
3863 candidate->convs[1]->type);
3864 else
3865 inform (cloc, "%s%<%D(%T)%> (built-in)", msg, fn,
3866 candidate->convs[0]->type);
3867 }
3868 else if (TYPE_P (fn)(tree_code_type[(int) (((enum tree_code) (fn)->base.code))
] == tcc_type)
)
3869 inform (cloc, "%s%qT (conversion)", msg, fn);
3870 else if (candidate->viable == -1)
3871 inform (cloc, "%s%#qD (near match)", msg, fn);
3872 else if (DECL_DELETED_FN (fn)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? (
(struct tree_template_decl *)(const_cast<union tree_node *
> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3872, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3872, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (fn)->base.code) == FUNCTION_DECL || (((
enum tree_code) (fn)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3872, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3872, __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/call.c"
, 3872, __FUNCTION__); &lt->u.fn; })->min.base.threadprivate_or_deleted_p
)
)
3873 inform (cloc, "%s%#qD (deleted)", msg, fn);
3874 else if (candidate->reversed ())
3875 inform (cloc, "%s%#qD (reversed)", msg, fn);
3876 else if (candidate->rewritten ())
3877 inform (cloc, "%s%#qD (rewritten)", msg, fn);
3878 else
3879 inform (cloc, "%s%#qD", msg, fn);
3880 if (fn != candidate->fn)
3881 {
3882 cloc = location_of (candidate->fn);
3883 inform (cloc, " inherited here");
3884 }
3885 /* Give the user some information about why this candidate failed. */
3886 if (candidate->reason != NULL__null)
3887 {
3888 struct rejection_reason *r = candidate->reason;
3889
3890 switch (r->code)
3891 {
3892 case rr_arity:
3893 print_arity_information (cloc, r->u.arity.actual,
3894 r->u.arity.expected,
3895 r->u.arity.least_p);
3896 break;
3897 case rr_arg_conversion:
3898 print_conversion_rejection (cloc, &r->u.conversion, fn);
3899 break;
3900 case rr_bad_arg_conversion:
3901 print_conversion_rejection (cloc, &r->u.bad_conversion, fn);
3902 break;
3903 case rr_explicit_conversion:
3904 inform (cloc, " return type %qT of explicit conversion function "
3905 "cannot be converted to %qT with a qualification "
3906 "conversion", r->u.conversion.from,
3907 r->u.conversion.to_type);
3908 break;
3909 case rr_template_conversion:
3910 inform (cloc, " conversion from return type %qT of template "
3911 "conversion function specialization to %qT is not an "
3912 "exact match", r->u.conversion.from,
3913 r->u.conversion.to_type);
3914 break;
3915 case rr_template_unification:
3916 /* We use template_unification_error_rejection if unification caused
3917 actual non-SFINAE errors, in which case we don't need to repeat
3918 them here. */
3919 if (r->u.template_unification.tmpl == NULL_TREE(tree) __null)
3920 {
3921 inform (cloc, " substitution of deduced template arguments "
3922 "resulted in errors seen above");
3923 break;
3924 }
3925 /* Re-run template unification with diagnostics. */
3926 inform (cloc, " template argument deduction/substitution failed:");
3927 fn_type_unification (r->u.template_unification.tmpl,
3928 r->u.template_unification.explicit_targs,
3929 (make_tree_vec
3930 (r->u.template_unification.num_targs)),
3931 r->u.template_unification.args,
3932 r->u.template_unification.nargs,
3933 r->u.template_unification.return_type,
3934 r->u.template_unification.strict,
3935 r->u.template_unification.flags,
3936 NULL__null, true, false);
3937 break;
3938 case rr_invalid_copy:
3939 inform (cloc,
3940 " a constructor taking a single argument of its own "
3941 "class type is invalid");
3942 break;
3943 case rr_constraint_failure:
3944 diagnose_constraints (cloc, fn, NULL_TREE(tree) __null);
3945 break;
3946 case rr_inherited_ctor:
3947 inform (cloc, " an inherited constructor is not a candidate for "
3948 "initialization from an expression of the same or derived "
3949 "type");
3950 break;
3951 case rr_none:
3952 default:
3953 /* This candidate didn't have any issues or we failed to
3954 handle a particular code. Either way... */
3955 gcc_unreachable ()(fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3955, __FUNCTION__))
;
3956 }
3957 }
3958}
3959
3960static void
3961print_z_candidates (location_t loc, struct z_candidate *candidates)
3962{
3963 struct z_candidate *cand1;
3964 struct z_candidate **cand2;
3965
3966 if (!candidates)
3967 return;
3968
3969 /* Remove non-viable deleted candidates. */
3970 cand1 = candidates;
3971 for (cand2 = &cand1; *cand2; )
3972 {
3973 if (TREE_CODE ((*cand2)->fn)((enum tree_code) ((*cand2)->fn)->base.code) == FUNCTION_DECL
3974 && !(*cand2)->viable
3975 && DECL_DELETED_FN ((*cand2)->fn)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) ((*cand2)->fn)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check (((*cand2)->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3975, __FUNCTION__, (TEMPLATE_DECL))))))))->result : (*cand2
)->fn)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3975, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) ((*cand2)->fn)->base.code) == FUNCTION_DECL
|| (((enum tree_code) ((*cand2)->fn)->base.code) == TEMPLATE_DECL
&& ((struct tree_template_decl *)(const_cast<union
tree_node *> ((((tree_check (((*cand2)->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3975, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check (((*cand2
)->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 3975, __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/call.c"
, 3975, __FUNCTION__); &lt->u.fn; })->min.base.threadprivate_or_deleted_p
)
)
3976 *cand2 = (*cand2)->next;
3977 else
3978 cand2 = &(*cand2)->next;
3979 }
3980 /* ...if there are any non-deleted ones. */
3981 if (cand1)
3982 candidates = cand1;
3983
3984 /* There may be duplicates in the set of candidates. We put off
3985 checking this condition as long as possible, since we have no way
3986 to eliminate duplicates from a set of functions in less than n^2
3987 time. Now we are about to emit an error message, so it is more
3988 permissible to go slowly. */
3989 for (cand1 = candidates; cand1; cand1 = cand1->next)
3990 {
3991 tree fn = cand1->fn;
3992 /* Skip builtin candidates and conversion functions. */
3993 if (!DECL_P (fn)(tree_code_type[(int) (((enum tree_code) (fn)->base.code))
] == tcc_declaration)
)
3994 continue;
3995 cand2 = &cand1->next;
3996 while (*cand2)
3997 {
3998 if (DECL_P ((*cand2)->fn)(tree_code_type[(int) (((enum tree_code) ((*cand2)->fn)->
base.code))] == tcc_declaration)
3999 && equal_functions (fn, (*cand2)->fn))
4000 *cand2 = (*cand2)->next;
4001 else
4002 cand2 = &(*cand2)->next;
4003 }
4004 }
4005
4006 for (; candidates; candidates = candidates->next)
4007 print_z_candidate (loc, N_("candidate:")"candidate:", candidates);
4008}
4009
4010/* USER_SEQ is a user-defined conversion sequence, beginning with a
4011 USER_CONV. STD_SEQ is the standard conversion sequence applied to
4012 the result of the conversion function to convert it to the final
4013 desired type. Merge the two sequences into a single sequence,
4014 and return the merged sequence. */
4015
4016static conversion *
4017merge_conversion_sequences (conversion *user_seq, conversion *std_seq)
4018{
4019 conversion **t;
4020 bool bad = user_seq->bad_p;
4021
4022 gcc_assert (user_seq->kind == ck_user)((void)(!(user_seq->kind == ck_user) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4022, __FUNCTION__), 0 : 0))
;
4023
4024 /* Find the end of the second conversion sequence. */
4025 for (t = &std_seq; (*t)->kind != ck_identity; t = &((*t)->u.next))
4026 {
4027 /* The entire sequence is a user-conversion sequence. */
4028 (*t)->user_conv_p = true;
4029 if (bad)
4030 (*t)->bad_p = true;
4031 }
4032
4033 if ((*t)->rvaluedness_matches_p)
4034 /* We're binding a reference directly to the result of the conversion.
4035 build_user_type_conversion_1 stripped the REFERENCE_TYPE from the return
4036 type, but we want it back. */
4037 user_seq->type = TREE_TYPE (TREE_TYPE (user_seq->cand->fn))((contains_struct_check ((((contains_struct_check ((user_seq->
cand->fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4037, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4037, __FUNCTION__))->typed.type)
;
4038
4039 /* Replace the identity conversion with the user conversion
4040 sequence. */
4041 *t = user_seq;
4042
4043 return std_seq;
4044}
4045
4046/* Handle overload resolution for initializing an object of class type from
4047 an initializer list. First we look for a suitable constructor that
4048 takes a std::initializer_list; if we don't find one, we then look for a
4049 non-list constructor.
4050
4051 Parameters are as for add_candidates, except that the arguments are in
4052 the form of a CONSTRUCTOR (the initializer list) rather than a vector, and
4053 the RETURN_TYPE parameter is replaced by TOTYPE, the desired type. */
4054
4055static void
4056add_list_candidates (tree fns, tree first_arg,
4057 const vec<tree, va_gc> *args, tree totype,
4058 tree explicit_targs, bool template_only,
4059 tree conversion_path, tree access_path,
4060 int flags,
4061 struct z_candidate **candidates,
4062 tsubst_flags_t complain)
4063{
4064 gcc_assert (*candidates == NULL)((void)(!(*candidates == __null) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4064, __FUNCTION__), 0 : 0))
;
4065
4066 /* We're looking for a ctor for list-initialization. */
4067 flags |= LOOKUP_LIST_INIT_CTOR((((1 << 6) << 1) << 1) << 1);
4068 /* And we don't allow narrowing conversions. We also use this flag to
4069 avoid the copy constructor call for copy-list-initialization. */
4070 flags |= LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1);
4071
4072 unsigned nart = num_artificial_parms_for (OVL_FIRST (fns)ovl_first (fns)) - 1;
4073 tree init_list = (*args)[nart];
4074
4075 /* Always use the default constructor if the list is empty (DR 990). */
4076 if (CONSTRUCTOR_NELTS (init_list)(vec_safe_length (((tree_check ((init_list), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4076, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
== 0
4077 && TYPE_HAS_DEFAULT_CONSTRUCTOR (totype)((((tree_class_check ((totype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4077, __FUNCTION__))->type_with_lang_specific.lang_specific
))->has_default_ctor)
)
4078 ;
4079 /* If the class has a list ctor, try passing the list as a single
4080 argument first, but only consider list ctors. */
4081 else if (TYPE_HAS_LIST_CTOR (totype)((((tree_class_check ((totype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4081, __FUNCTION__))->type_with_lang_specific.lang_specific
))->has_list_ctor)
)
4082 {
4083 flags |= LOOKUP_LIST_ONLY((((((1 << 6) << 1) << 1) << 1) <<
1) << 1)
;
4084 add_candidates (fns, first_arg, args, NULL_TREE(tree) __null,
4085 explicit_targs, template_only, conversion_path,
4086 access_path, flags, candidates, complain);
4087 if (any_strictly_viable (*candidates))
4088 return;
4089 }
4090 else if (CONSTRUCTOR_IS_DESIGNATED_INIT (init_list)(((tree_not_check2 (((tree_check ((init_list), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4090, __FUNCTION__, (CONSTRUCTOR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4090, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_6))
4091 && !CP_AGGREGATE_TYPE_P (totype)(gnu_vector_type_p (totype) || ((enum tree_code) (totype)->
base.code) == ARRAY_TYPE || ((((((enum tree_code) (totype)->
base.code)) == RECORD_TYPE || (((enum tree_code) (totype)->
base.code)) == UNION_TYPE) && ((tree_class_check ((totype
), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4091, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((totype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4091, __FUNCTION__))->type_common.size) != (tree) __null
) && !((((tree_class_check ((totype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4091, __FUNCTION__))->type_with_lang_specific.lang_specific
))->non_aggregate)))
)
4092 {
4093 if (complain & tf_error)
4094 error ("designated initializers cannot be used with a "
4095 "non-aggregate type %qT", totype);
4096 return;
4097 }
4098
4099 /* Expand the CONSTRUCTOR into a new argument vec. */
4100 vec<tree, va_gc> *new_args;
4101 vec_alloc (new_args, nart + CONSTRUCTOR_NELTS (init_list)(vec_safe_length (((tree_check ((init_list), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4101, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
);
4102 for (unsigned i = 0; i < nart; ++i)
4103 new_args->quick_push ((*args)[i]);
4104 for (unsigned i = 0; i < CONSTRUCTOR_NELTS (init_list)(vec_safe_length (((tree_check ((init_list), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4104, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts)))
; ++i)
4105 new_args->quick_push (CONSTRUCTOR_ELT (init_list, i)(&(*((tree_check ((init_list), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4105, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
i])
->value);
4106
4107 /* We aren't looking for list-ctors anymore. */
4108 flags &= ~LOOKUP_LIST_ONLY((((((1 << 6) << 1) << 1) << 1) <<
1) << 1)
;
4109 /* We allow more user-defined conversions within an init-list. */
4110 flags &= ~LOOKUP_NO_CONVERSION(1 << 4);
4111
4112 add_candidates (fns, first_arg, new_args, NULL_TREE(tree) __null,
4113 explicit_targs, template_only, conversion_path,
4114 access_path, flags, candidates, complain);
4115}
4116
4117/* Returns the best overload candidate to perform the requested
4118 conversion. This function is used for three the overloading situations
4119 described in [over.match.copy], [over.match.conv], and [over.match.ref].
4120 If TOTYPE is a REFERENCE_TYPE, we're trying to find a direct binding as
4121 per [dcl.init.ref], so we ignore temporary bindings. */
4122
4123static struct z_candidate *
4124build_user_type_conversion_1 (tree totype, tree expr, int flags,
4125 tsubst_flags_t complain)
4126{
4127 struct z_candidate *candidates, *cand;
4128 tree fromtype;
4129 tree ctors = NULL_TREE(tree) __null;
4130 tree conv_fns = NULL_TREE(tree) __null;
4131 conversion *conv = NULL__null;
4132 tree first_arg = NULL_TREE(tree) __null;
4133 vec<tree, va_gc> *args = NULL__null;
4134 bool any_viable_p;
4135 int convflags;
4136
4137 if (!expr)
4138 return NULL__null;
4139
4140 fromtype = TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4140, __FUNCTION__))->typed.type)
;
4141
4142 /* We represent conversion within a hierarchy using RVALUE_CONV and
4143 BASE_CONV, as specified by [over.best.ics]; these become plain
4144 constructor calls, as specified in [dcl.init]. */
4145 gcc_assert (!MAYBE_CLASS_TYPE_P (fromtype) || !MAYBE_CLASS_TYPE_P (totype)((void)(!(!((((enum tree_code) (fromtype)->base.code) == TEMPLATE_TYPE_PARM
|| ((enum tree_code) (fromtype)->base.code) == TYPENAME_TYPE
|| ((enum tree_code) (fromtype)->base.code) == TYPEOF_TYPE
|| ((enum tree_code) (fromtype)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (fromtype)->base.code) == DECLTYPE_TYPE
) || (((((enum tree_code) (fromtype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (fromtype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((fromtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4145, __FUNCTION__))->type_common.lang_flag_5))) || !(((
(enum tree_code) (totype)->base.code) == TEMPLATE_TYPE_PARM
|| ((enum tree_code) (totype)->base.code) == TYPENAME_TYPE
|| ((enum tree_code) (totype)->base.code) == TYPEOF_TYPE ||
((enum tree_code) (totype)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (totype)->base.code) == DECLTYPE_TYPE
) || (((((enum tree_code) (totype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (totype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((totype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4145, __FUNCTION__))->type_common.lang_flag_5))) || !(lookup_base
((fromtype), (totype), ba_any, __null, tf_none) != (tree) __null
)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4146, __FUNCTION__), 0 : 0))
4146 || !DERIVED_FROM_P (totype, fromtype))((void)(!(!((((enum tree_code) (fromtype)->base.code) == TEMPLATE_TYPE_PARM
|| ((enum tree_code) (fromtype)->base.code) == TYPENAME_TYPE
|| ((enum tree_code) (fromtype)->base.code) == TYPEOF_TYPE
|| ((enum tree_code) (fromtype)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (fromtype)->base.code) == DECLTYPE_TYPE
) || (((((enum tree_code) (fromtype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (fromtype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((fromtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4145, __FUNCTION__))->type_common.lang_flag_5))) || !(((
(enum tree_code) (totype)->base.code) == TEMPLATE_TYPE_PARM
|| ((enum tree_code) (totype)->base.code) == TYPENAME_TYPE
|| ((enum tree_code) (totype)->base.code) == TYPEOF_TYPE ||
((enum tree_code) (totype)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (totype)->base.code) == DECLTYPE_TYPE
) || (((((enum tree_code) (totype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (totype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((totype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4145, __FUNCTION__))->type_common.lang_flag_5))) || !(lookup_base
((fromtype), (totype), ba_any, __null, tf_none) != (tree) __null
)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4146, __FUNCTION__), 0 : 0))
;
4147
4148 if (CLASS_TYPE_P (totype)(((((enum tree_code) (totype)->base.code)) == RECORD_TYPE ||
(((enum tree_code) (totype)->base.code)) == UNION_TYPE) &&
((tree_class_check ((totype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4148, __FUNCTION__))->type_common.lang_flag_5))
)
4149 /* Use lookup_fnfields_slot instead of lookup_fnfields to avoid
4150 creating a garbage BASELINK; constructors can't be inherited. */
4151 ctors = get_class_binding (totype, complete_ctor_identifiercp_global_trees[CPTI_COMPLETE_CTOR_IDENTIFIER]);
4152
4153 tree to_nonref = non_reference (totype);
4154 if (MAYBE_CLASS_TYPE_P (fromtype)((((enum tree_code) (fromtype)->base.code) == TEMPLATE_TYPE_PARM
|| ((enum tree_code) (fromtype)->base.code) == TYPENAME_TYPE
|| ((enum tree_code) (fromtype)->base.code) == TYPEOF_TYPE
|| ((enum tree_code) (fromtype)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (fromtype)->base.code) == DECLTYPE_TYPE
) || (((((enum tree_code) (fromtype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (fromtype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((fromtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4154, __FUNCTION__))->type_common.lang_flag_5)))
)
4155 {
4156 if (same_type_ignoring_top_level_qualifiers_p (to_nonref, fromtype) ||
4157 (CLASS_TYPE_P (to_nonref)(((((enum tree_code) (to_nonref)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (to_nonref)->base.code)) == UNION_TYPE
) && ((tree_class_check ((to_nonref), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4157, __FUNCTION__))->type_common.lang_flag_5))
&& CLASS_TYPE_P (fromtype)(((((enum tree_code) (fromtype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (fromtype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((fromtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4157, __FUNCTION__))->type_common.lang_flag_5))
4158 && DERIVED_FROM_P (to_nonref, fromtype)(lookup_base ((fromtype), (to_nonref), ba_any, __null, tf_none
) != (tree) __null)
))
4159 {
4160 /* [class.conv.fct] A conversion function is never used to
4161 convert a (possibly cv-qualified) object to the (possibly
4162 cv-qualified) same object type (or a reference to it), to a
4163 (possibly cv-qualified) base class of that type (or a
4164 reference to it)... */
4165 }
4166 else
4167 conv_fns = lookup_conversions (fromtype);
4168 }
4169
4170 candidates = 0;
4171 flags |= LOOKUP_NO_CONVERSION(1 << 4);
4172 if (BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4172, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
4173 flags |= LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1);
4174 /* Prevent add_candidates from treating a non-strictly viable candidate
4175 as unviable. */
4176 complain |= tf_conv;
4177
4178 /* It's OK to bind a temporary for converting constructor arguments, but
4179 not in converting the return value of a conversion operator. */
4180 convflags = ((flags & LOOKUP_NO_TEMP_BIND(1 << 6)) | LOOKUP_NO_CONVERSION(1 << 4)
4181 | (flags & LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1)));
4182 flags &= ~LOOKUP_NO_TEMP_BIND(1 << 6);
4183
4184 if (ctors)
4185 {
4186 int ctorflags = flags;
4187
4188 first_arg = build_dummy_object (totype);
4189
4190 /* We should never try to call the abstract or base constructor
4191 from here. */
4192 gcc_assert (!DECL_HAS_IN_CHARGE_PARM_P (OVL_FIRST (ctors))((void)(!(!(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (ovl_first (ctors))->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4192, __FUNCTION__, (TEMPLATE_DECL))))))))->result : ovl_first
(ctors))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4192, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (ovl_first (ctors))->base.code) == FUNCTION_DECL
|| (((enum tree_code) (ovl_first (ctors))->base.code) == TEMPLATE_DECL
&& ((struct tree_template_decl *)(const_cast<union
tree_node *> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4192, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((ovl_first
(ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4192, __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/call.c"
, 4192, __FUNCTION__); &lt->u.fn; })->has_in_charge_parm_p
) && !(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (ovl_first (ctors))->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4193, __FUNCTION__, (TEMPLATE_DECL))))))))->result : ovl_first
(ctors))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4193, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (ovl_first (ctors))->base.code) == FUNCTION_DECL
|| (((enum tree_code) (ovl_first (ctors))->base.code) == TEMPLATE_DECL
&& ((struct tree_template_decl *)(const_cast<union
tree_node *> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4193, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((ovl_first
(ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4193, __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/call.c"
, 4193, __FUNCTION__); &lt->u.fn; })->has_vtt_parm_p
)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4193, __FUNCTION__), 0 : 0))
4193 && !DECL_HAS_VTT_PARM_P (OVL_FIRST (ctors)))((void)(!(!(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (ovl_first (ctors))->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4192, __FUNCTION__, (TEMPLATE_DECL))))))))->result : ovl_first
(ctors))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4192, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (ovl_first (ctors))->base.code) == FUNCTION_DECL
|| (((enum tree_code) (ovl_first (ctors))->base.code) == TEMPLATE_DECL
&& ((struct tree_template_decl *)(const_cast<union
tree_node *> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4192, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((ovl_first
(ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4192, __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/call.c"
, 4192, __FUNCTION__); &lt->u.fn; })->has_in_charge_parm_p
) && !(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (ovl_first (ctors))->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4193, __FUNCTION__, (TEMPLATE_DECL))))))))->result : ovl_first
(ctors))), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4193, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (ovl_first (ctors))->base.code) == FUNCTION_DECL
|| (((enum tree_code) (ovl_first (ctors))->base.code) == TEMPLATE_DECL
&& ((struct tree_template_decl *)(const_cast<union
tree_node *> ((((tree_check ((ovl_first (ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4193, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((ovl_first
(ctors)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4193, __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/call.c"
, 4193, __FUNCTION__); &lt->u.fn; })->has_vtt_parm_p
)) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4193, __FUNCTION__), 0 : 0))
;
4194
4195 args = make_tree_vector_single (expr);
4196 if (BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4196, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
4197 {
4198 /* List-initialization. */
4199 add_list_candidates (ctors, first_arg, args, totype, NULL_TREE(tree) __null,
4200 false, TYPE_BINFO (totype)((tree_check3 ((totype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4200, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
, TYPE_BINFO (totype)((tree_check3 ((totype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4200, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
,
4201 ctorflags, &candidates, complain);
4202 }
4203 else
4204 {
4205 add_candidates (ctors, first_arg, args, NULL_TREE(tree) __null, NULL_TREE(tree) __null, false,
4206 TYPE_BINFO (totype)((tree_check3 ((totype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4206, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
, TYPE_BINFO (totype)((tree_check3 ((totype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4206, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
,
4207 ctorflags, &candidates, complain);
4208 }
4209
4210 for (cand = candidates; cand; cand = cand->next)
4211 {
4212 cand->second_conv = build_identity_conv (totype, NULL_TREE(tree) __null);
4213
4214 /* If totype isn't a reference, and LOOKUP_ONLYCONVERTING is
4215 set, then this is copy-initialization. In that case, "The
4216 result of the call is then used to direct-initialize the
4217 object that is the destination of the copy-initialization."
4218 [dcl.init]
4219
4220 We represent this in the conversion sequence with an
4221 rvalue conversion, which means a constructor call. */
4222 if (!TYPE_REF_P (totype)(((enum tree_code) (totype)->base.code) == REFERENCE_TYPE)
4223 && cxx_dialect < cxx17
4224 && (flags & LOOKUP_ONLYCONVERTING(1 << 2))
4225 && !(convflags & LOOKUP_NO_TEMP_BIND(1 << 6)))
4226 cand->second_conv
4227 = build_conv (ck_rvalue, totype, cand->second_conv);
4228 }
4229 }
4230
4231 if (conv_fns)
4232 {
4233 if (BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4233, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
)
4234 first_arg = CONSTRUCTOR_ELT (expr, 0)(&(*((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4234, __FUNCTION__, (CONSTRUCTOR)))->constructor.elts))[
0])
->value;
4235 else
4236 first_arg = expr;
4237 }
4238
4239 for (; conv_fns; conv_fns = TREE_CHAIN (conv_fns)((contains_struct_check ((conv_fns), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4239, __FUNCTION__))->common.chain)
)
4240 {
4241 tree conversion_path = TREE_PURPOSE (conv_fns)((tree_check ((conv_fns), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4241, __FUNCTION__, (TREE_LIST)))->list.purpose)
;
4242 struct z_candidate *old_candidates;
4243
4244 /* If LOOKUP_NO_CONVERSION, don't consider a conversion function that
4245 would need an addional user-defined conversion, i.e. if the return
4246 type differs in class-ness from the desired type. So we avoid
4247 considering operator bool when calling a copy constructor.
4248
4249 This optimization avoids the failure in PR97600, and is allowed by
4250 [temp.inst]/9: "If the function selected by overload resolution can be
4251 determined without instantiating a class template definition, it is
4252 unspecified whether that instantiation actually takes place." */
4253 tree convtype = non_reference (TREE_TYPE (conv_fns)((contains_struct_check ((conv_fns), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4253, __FUNCTION__))->typed.type)
);
4254 if ((flags & LOOKUP_NO_CONVERSION(1 << 4))
4255 && !WILDCARD_TYPE_P (convtype)(((enum tree_code) (convtype)->base.code) == TEMPLATE_TYPE_PARM
|| ((enum tree_code) (convtype)->base.code) == TYPENAME_TYPE
|| ((enum tree_code) (convtype)->base.code) == TYPEOF_TYPE
|| ((enum tree_code) (convtype)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (convtype)->base.code) == DECLTYPE_TYPE
)
4256 && (CLASS_TYPE_P (to_nonref)(((((enum tree_code) (to_nonref)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (to_nonref)->base.code)) == UNION_TYPE
) && ((tree_class_check ((to_nonref), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4256, __FUNCTION__))->type_common.lang_flag_5))
4257 != CLASS_TYPE_P (convtype)(((((enum tree_code) (convtype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (convtype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((convtype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4257, __FUNCTION__))->type_common.lang_flag_5))
))
4258 continue;
4259
4260 /* If we are called to convert to a reference type, we are trying to
4261 find a direct binding, so don't even consider temporaries. If
4262 we don't find a direct binding, the caller will try again to
4263 look for a temporary binding. */
4264 if (TYPE_REF_P (totype)(((enum tree_code) (totype)->base.code) == REFERENCE_TYPE))
4265 convflags |= LOOKUP_NO_TEMP_BIND(1 << 6);
4266
4267 old_candidates = candidates;
4268 add_candidates (TREE_VALUE (conv_fns)((tree_check ((conv_fns), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4268, __FUNCTION__, (TREE_LIST)))->list.value)
, first_arg, NULL__null, totype,
4269 NULL_TREE(tree) __null, false,
4270 conversion_path, TYPE_BINFO (fromtype)((tree_check3 ((fromtype), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4270, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
,
4271 flags, &candidates, complain);
4272
4273 for (cand = candidates; cand != old_candidates; cand = cand->next)
4274 {
4275 if (cand->viable == 0)
4276 /* Already rejected, don't change to -1. */
4277 continue;
4278
4279 tree rettype = TREE_TYPE (TREE_TYPE (cand->fn))((contains_struct_check ((((contains_struct_check ((cand->
fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4279, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4279, __FUNCTION__))->typed.type)
;
4280 conversion *ics
4281 = implicit_conversion (totype,
4282 rettype,
4283 0,
4284 /*c_cast_p=*/false, convflags,
4285 complain);
4286
4287 /* If LOOKUP_NO_TEMP_BIND isn't set, then this is
4288 copy-initialization. In that case, "The result of the
4289 call is then used to direct-initialize the object that is
4290 the destination of the copy-initialization." [dcl.init]
4291
4292 We represent this in the conversion sequence with an
4293 rvalue conversion, which means a constructor call. But
4294 don't add a second rvalue conversion if there's already
4295 one there. Which there really shouldn't be, but it's
4296 harmless since we'd add it here anyway. */
4297 if (ics && MAYBE_CLASS_TYPE_P (totype)((((enum tree_code) (totype)->base.code) == TEMPLATE_TYPE_PARM
|| ((enum tree_code) (totype)->base.code) == TYPENAME_TYPE
|| ((enum tree_code) (totype)->base.code) == TYPEOF_TYPE ||
((enum tree_code) (totype)->base.code) == BOUND_TEMPLATE_TEMPLATE_PARM
|| ((enum tree_code) (totype)->base.code) == DECLTYPE_TYPE
) || (((((enum tree_code) (totype)->base.code)) == RECORD_TYPE
|| (((enum tree_code) (totype)->base.code)) == UNION_TYPE
) && ((tree_class_check ((totype), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4297, __FUNCTION__))->type_common.lang_flag_5)))
&& ics->kind != ck_rvalue
4298 && !(convflags & LOOKUP_NO_TEMP_BIND(1 << 6)))
4299 ics = build_conv (ck_rvalue, totype, ics);
4300
4301 cand->second_conv = ics;
4302
4303 if (!ics)
4304 {
4305 cand->viable = 0;
4306 cand->reason = arg_conversion_rejection (NULL_TREE(tree) __null, -2,
4307 rettype, totype,
4308 EXPR_LOCATION (expr)((((expr)) && ((tree_code_type[(int) (((enum tree_code
) ((expr))->base.code))]) >= tcc_reference && (
tree_code_type[(int) (((enum tree_code) ((expr))->base.code
))]) <= tcc_expression)) ? (expr)->exp.locus : ((location_t
) 0))
);
4309 }
4310 else if (TYPE_REF_P (totype)(((enum tree_code) (totype)->base.code) == REFERENCE_TYPE) && !ics->rvaluedness_matches_p
4311 /* Limit this to non-templates for now (PR90546). */
4312 && !cand->template_decl
4313 && TREE_CODE (TREE_TYPE (totype))((enum tree_code) (((contains_struct_check ((totype), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4313, __FUNCTION__))->typed.type))->base.code)
!= FUNCTION_TYPE)
4314 {
4315 /* If we are called to convert to a reference type, we are trying
4316 to find a direct binding per [over.match.ref], so rvaluedness
4317 must match for non-functions. */
4318 cand->viable = 0;
4319 }
4320 else if (DECL_NONCONVERTING_P (cand->fn)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (cand->fn)->base.code) == TEMPLATE_DECL
? ((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((cand->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4320, __FUNCTION__, (TEMPLATE_DECL))))))))->result : cand
->fn)), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4320, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (cand->fn)->base.code) == FUNCTION_DECL
|| (((enum tree_code) (cand->fn)->base.code) == TEMPLATE_DECL
&& ((struct tree_template_decl *)(const_cast<union
tree_node *> ((((tree_check ((cand->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4320, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((cand
->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4320, __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/call.c"
, 4320, __FUNCTION__); &lt->u.fn; })->nonconverting
)
4321 && ics->rank > cr_exact)
4322 {
4323 /* 13.3.1.5: For direct-initialization, those explicit
4324 conversion functions that are not hidden within S and
4325 yield type T or a type that can be converted to type T
4326 with a qualification conversion (4.4) are also candidate
4327 functions. */
4328 /* 13.3.1.6 doesn't have a parallel restriction, but it should;
4329 I've raised this issue with the committee. --jason 9/2011 */
4330 cand->viable = -1;
4331 cand->reason = explicit_conversion_rejection (rettype, totype);
4332 }
4333 else if (cand->viable == 1 && ics->bad_p)
4334 {
4335 cand->viable = -1;
4336 cand->reason
4337 = bad_arg_conversion_rejection (NULL_TREE(tree) __null, -2,
4338 rettype, totype,
4339 EXPR_LOCATION (expr)((((expr)) && ((tree_code_type[(int) (((enum tree_code
) ((expr))->base.code))]) >= tcc_reference && (
tree_code_type[(int) (((enum tree_code) ((expr))->base.code
))]) <= tcc_expression)) ? (expr)->exp.locus : ((location_t
) 0))
);
4340 }
4341 else if (primary_template_specialization_p (cand->fn)
4342 && ics->rank > cr_exact)
4343 {
4344 /* 13.3.3.1.2: If the user-defined conversion is specified by
4345 a specialization of a conversion function template, the
4346 second standard conversion sequence shall have exact match
4347 rank. */
4348 cand->viable = -1;
4349 cand->reason = template_conversion_rejection (rettype, totype);
4350 }
4351 }
4352 }
4353
4354 candidates = splice_viable (candidates, false, &any_viable_p);
4355 if (!any_viable_p)
4356 {
4357 if (args)
4358 release_tree_vector (args);
4359 return NULL__null;
4360 }
4361
4362 cand = tourney (candidates, complain);
4363 if (cand == NULL__null)
4364 {
4365 if (complain & tf_error)
4366 {
4367 auto_diagnostic_group d;
4368 error_at (cp_expr_loc_or_input_loc (expr),
4369 "conversion from %qH to %qI is ambiguous",
4370 fromtype, totype);
4371 print_z_candidates (location_of (expr), candidates);
4372 }
4373
4374 cand = candidates; /* any one will do */
4375 cand->second_conv = build_ambiguous_conv (totype, expr);
4376 cand->second_conv->user_conv_p = true;
4377 if (!any_strictly_viable (candidates))
4378 cand->second_conv->bad_p = true;
4379 if (flags & LOOKUP_ONLYCONVERTING(1 << 2))
4380 cand->second_conv->need_temporary_p = true;
4381 /* If there are viable candidates, don't set ICS_BAD_FLAG; an
4382 ambiguous conversion is no worse than another user-defined
4383 conversion. */
4384
4385 return cand;
4386 }
4387
4388 tree convtype;
4389 if (!DECL_CONSTRUCTOR_P (cand->fn)((tree_check (((((enum tree_code) (cand->fn)->base.code
) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast
<union tree_node *> ((((tree_check ((cand->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4389, __FUNCTION__, (TEMPLATE_DECL))))))))->result : cand
->fn)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4389, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
4390 convtype = non_reference (TREE_TYPE (TREE_TYPE (cand->fn))((contains_struct_check ((((contains_struct_check ((cand->
fn), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4390, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4390, __FUNCTION__))->typed.type)
);
4391 else if (cand->second_conv->kind == ck_rvalue)
4392 /* DR 5: [in the first step of copy-initialization]...if the function
4393 is a constructor, the call initializes a temporary of the
4394 cv-unqualified version of the destination type. */
4395 convtype = cv_unqualified (totype);
4396 else
4397 convtype = totype;
4398 /* Build the user conversion sequence. */
4399 conv = build_conv
4400 (ck_user,
4401 convtype,
4402 build_identity_conv (TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4402, __FUNCTION__))->typed.type)
, expr));
4403 conv->cand = cand;
4404 if (cand->viable == -1)
4405 conv->bad_p = true;
4406
4407 /* We're performing the maybe-rvalue overload resolution and
4408 a conversion function is in play. Reject converting the return
4409 value of the conversion function to a base class. */
4410 if ((flags & LOOKUP_PREFER_RVALUE((1 << 6) << 1)) && !DECL_CONSTRUCTOR_P (cand->fn)((tree_check (((((enum tree_code) (cand->fn)->base.code
) == TEMPLATE_DECL ? ((struct tree_template_decl *)(const_cast
<union tree_node *> ((((tree_check ((cand->fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4410, __FUNCTION__, (TEMPLATE_DECL))))))))->result : cand
->fn)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4410, __FUNCTION__, (FUNCTION_DECL)))->decl_with_vis.cxx_constructor
)
)
4411 for (conversion *t = cand->second_conv; t; t = next_conversion (t))
4412 if (t->kind == ck_base)
4413 return NULL__null;
4414
4415 /* Remember that this was a list-initialization. */
4416 if (flags & LOOKUP_NO_NARROWING(((1 << 6) << 1) << 1))
4417 conv->check_narrowing = true;
4418
4419 /* Combine it with the second conversion sequence. */
4420 cand->second_conv = merge_conversion_sequences (conv,
4421 cand->second_conv);
4422
4423 return cand;
4424}
4425
4426/* Wrapper for above. */
4427
4428tree
4429build_user_type_conversion (tree totype, tree expr, int flags,
4430 tsubst_flags_t complain)
4431{
4432 struct z_candidate *cand;
4433 tree ret;
4434
4435 bool subtime = timevar_cond_start (TV_OVERLOAD);
4436 cand = build_user_type_conversion_1 (totype, expr, flags, complain);
4437
4438 if (cand)
4439 {
4440 if (cand->second_conv->kind == ck_ambig)
4441 ret = error_mark_nodeglobal_trees[TI_ERROR_MARK];
4442 else
4443 {
4444 expr = convert_like (cand->second_conv, expr, complain);
4445 ret = convert_from_reference (expr);
4446 }
4447 }
4448 else
4449 ret = NULL_TREE(tree) __null;
4450
4451 timevar_cond_stop (TV_OVERLOAD, subtime);
4452 return ret;
4453}
4454
4455/* Give a helpful diagnostic when implicit_conversion fails. */
4456
4457static void
4458implicit_conversion_error (location_t loc, tree type, tree expr)
4459{
4460 tsubst_flags_t complain = tf_warning_or_error;
4461
4462 /* If expr has unknown type, then it is an overloaded function.
4463 Call instantiate_type to get good error messages. */
4464 if (TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4464, __FUNCTION__))->typed.type)
== unknown_type_nodecp_global_trees[CPTI_UNKNOWN_TYPE])
4465 instantiate_type (type, expr, complain);
4466 else if (invalid_nonstatic_memfn_p (loc, expr, complain))
4467 /* We gave an error. */;
4468 else if (BRACE_ENCLOSED_INITIALIZER_P (expr)(((enum tree_code) (expr)->base.code) == CONSTRUCTOR &&
((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4468, __FUNCTION__))->typed.type) == cp_global_trees[CPTI_INIT_LIST_TYPE
])
4469 && CONSTRUCTOR_IS_DESIGNATED_INIT (expr)(((tree_not_check2 (((tree_check ((expr), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4469, __FUNCTION__, (CONSTRUCTOR)))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4469, __FUNCTION__, (TREE_VEC), (SSA_NAME)))->base.u.bits
.lang_flag_6))
4470 && !CP_AGGREGATE_TYPE_P (type)(gnu_vector_type_p (type) || ((enum tree_code) (type)->base
.code) == ARRAY_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/call.c"
, 4470, __FUNCTION__))->type_common.lang_flag_5)) &&
(((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4470, __FUNCTION__))->type_common.size) != (tree) __null
) && !((((tree_class_check ((type), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4470, __FUNCTION__))->type_with_lang_specific.lang_specific
))->non_aggregate)))
)
4471 error_at (loc, "designated initializers cannot be used with a "
4472 "non-aggregate type %qT", type);
4473 else
4474 {
4475 range_label_for_type_mismatch label (TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4475, __FUNCTION__))->typed.type)
, type);
4476 gcc_rich_location rich_loc (loc, &label);
4477 error_at (&rich_loc, "could not convert %qE from %qH to %qI",
4478 expr, TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4478, __FUNCTION__))->typed.type)
, type);
4479 }
4480}
4481
4482/* Worker for build_converted_constant_expr. */
4483
4484static tree
4485build_converted_constant_expr_internal (tree type, tree expr,
4486 int flags, tsubst_flags_t complain)
4487{
4488 conversion *conv;
4489 void *p;
4490 tree t;
4491 location_t loc = cp_expr_loc_or_input_loc (expr);
4492
4493 if (error_operand_p (expr))
4494 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4495
4496 /* Get the high-water mark for the CONVERSION_OBSTACK. */
4497 p = conversion_obstack_alloc (0);
4498
4499 conv = implicit_conversion (type, TREE_TYPE (expr)((contains_struct_check ((expr), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4499, __FUNCTION__))->typed.type)
, expr,
4500 /*c_cast_p=*/false, flags, complain);
4501
4502 /* A converted constant expression of type T is an expression, implicitly
4503 converted to type T, where the converted expression is a constant
4504 expression and the implicit conversion sequence contains only
4505
4506 * user-defined conversions,
4507 * lvalue-to-rvalue conversions (7.1),
4508 * array-to-pointer conversions (7.2),
4509 * function-to-pointer conversions (7.3),
4510 * qualification conversions (7.5),
4511 * integral promotions (7.6),
4512 * integral conversions (7.8) other than narrowing conversions (11.6.4),
4513 * null pointer conversions (7.11) from std::nullptr_t,
4514 * null member pointer conversions (7.12) from std::nullptr_t, and
4515 * function pointer conversions (7.13),
4516
4517 and where the reference binding (if any) binds directly. */
4518
4519 for (conversion *c = conv;
4520 c && c->kind != ck_identity;
4521 c = next_conversion (c))
4522 {
4523 switch (c->kind)
4524 {
4525 /* A conversion function is OK. If it isn't constexpr, we'll
4526 complain later that the argument isn't constant. */
4527 case ck_user:
4528 /* List-initialization is OK. */
4529 case ck_aggr:
4530 /* The lvalue-to-rvalue conversion is OK. */
4531 case ck_rvalue:
4532 /* Array-to-pointer and function-to-pointer. */
4533 case ck_lvalue:
4534 /* Function pointer conversions. */
4535 case ck_fnptr:
4536 /* Qualification conversions. */
4537 case ck_qual:
4538 break;
4539
4540 case ck_ref_bind:
4541 if (c->need_temporary_p)
4542 {
4543 if (complain & tf_error)
4544 error_at (loc, "initializing %qH with %qI in converted "
4545 "constant expression does not bind directly",
4546 type, next_conversion (c)->type);
4547 conv = NULL__null;
4548 }
4549 break;
4550
4551 case ck_base:
4552 case ck_pmem:
4553 case ck_ptr:
4554 case ck_std:
4555 t = next_conversion (c)->type;
4556 if (INTEGRAL_OR_ENUMERATION_TYPE_P (t)(((enum tree_code) (t)->base.code) == ENUMERAL_TYPE || (((
enum tree_code) (t)->base.code) == BOOLEAN_TYPE || ((enum tree_code
) (t)->base.code) == INTEGER_TYPE))
4557 && INTEGRAL_OR_ENUMERATION_TYPE_P (type)(((enum tree_code) (type)->base.code) == ENUMERAL_TYPE || (
((enum tree_code) (type)->base.code) == BOOLEAN_TYPE || ((
enum tree_code) (type)->base.code) == INTEGER_TYPE))
)
4558 /* Integral promotion or conversion. */
4559 break;
4560 if (NULLPTR_TYPE_P (t)(((enum tree_code) (t)->base.code) == NULLPTR_TYPE))
4561 /* Conversion from nullptr to pointer or pointer-to-member. */
4562 break;
4563
4564 if (complain & tf_error)
4565 error_at (loc, "conversion from %qH to %qI in a "
4566 "converted constant expression", t, type);
4567 /* fall through. */
4568
4569 default:
4570 conv = NULL__null;
4571 break;
4572 }
4573 }
4574
4575 /* Avoid confusing convert_nontype_argument by introducing
4576 a redundant conversion to the same reference type. */
4577 if (conv && conv->kind == ck_ref_bind
4578 && REFERENCE_REF_P (expr)((((enum tree_code) (expr)->base.code) == INDIRECT_REF) &&
((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
((expr), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4578, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4578, __FUNCTION__))->typed.type) && (((enum tree_code
) (((contains_struct_check (((*((const_cast<tree*> (tree_operand_check
(((expr)), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4578, __FUNCTION__)))))), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4578, __FUNCTION__))->typed.type))->base.code) == REFERENCE_TYPE
))
)
4579 {
4580 tree ref = 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/call.c"
, 4580, __FUNCTION__)))))
;
4581 if (same_type_p (type, TREE_TYPE (ref))comptypes ((type), (((contains_struct_check ((ref), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4581, __FUNCTION__))->typed.type)), 0)
)
4582 return ref;
4583 }
4584
4585 if (conv)
4586 {
4587 /* Don't copy a class in a template. */
4588 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/call.c"
, 4588, __FUNCTION__))->type_common.lang_flag_5))
&& conv->kind == ck_rvalue
4589 && processing_template_declscope_chain->x_processing_template_decl)
4590 conv = next_conversion (conv);
4591
4592 /* Issuing conversion warnings for value-dependent expressions is
4593 likely too noisy. */
4594 warning_sentinel w (warn_conversionglobal_options.x_warn_conversion);
4595 conv->check_narrowing = true;
4596 conv->check_narrowing_const_only = true;
4597 expr = convert_like (conv, expr, complain);
4598 }
4599 else
4600 {
4601 if (complain & tf_error)
4602 implicit_conversion_error (loc, type, expr);
4603 expr = error_mark_nodeglobal_trees[TI_ERROR_MARK];
4604 }
4605
4606 /* Free all the conversions we allocated. */
4607 obstack_free (&conversion_obstack, p)__extension__ ({ struct obstack *__o = (&conversion_obstack
); void *__obj = (void *) (p); if (__obj > (void *) __o->
chunk && __obj < (void *) __o->chunk_limit) __o
->next_free = __o->object_base = (char *) __obj; else _obstack_free
(__o, __obj); })
;
4608
4609 return expr;
4610}
4611
4612/* Subroutine of convert_nontype_argument.
4613
4614 EXPR is an expression used in a context that requires a converted
4615 constant-expression, such as a template non-type parameter. Do any
4616 necessary conversions (that are permitted for converted
4617 constant-expressions) to convert it to the desired type.
4618
4619 This function doesn't consider explicit conversion functions. If
4620 you mean to use "a contextually converted constant expression of type
4621 bool", use build_converted_constant_bool_expr.
4622
4623 If conversion is successful, returns the converted expression;
4624 otherwise, returns error_mark_node. */
4625
4626tree
4627build_converted_constant_expr (tree type, tree expr, tsubst_flags_t complain)
4628{
4629 return build_converted_constant_expr_internal (type, expr, LOOKUP_IMPLICIT(((1 << 0)) | (1 << 2)),
4630 complain);
4631}
4632
4633/* Used to create "a contextually converted constant expression of type
4634 bool". This differs from build_converted_constant_expr in that it
4635 also considers explicit conversion functions. */
4636
4637tree
4638build_converted_constant_bool_expr (tree expr, tsubst_flags_t complain)
4639{
4640 return build_converted_constant_expr_internal (boolean_type_nodeglobal_trees[TI_BOOLEAN_TYPE], expr,
4641 LOOKUP_NORMAL((1 << 0)), complain);
4642}
4643
4644/* Do any initial processing on the arguments to a function call. */
4645
4646vec<tree, va_gc> *
4647resolve_args (vec<tree, va_gc> *args, tsubst_flags_t complain)
4648{
4649 unsigned int ix;
4650 tree arg;
4651
4652 FOR_EACH_VEC_SAFE_ELT (args, ix, arg)for (ix = 0; vec_safe_iterate ((args), (ix), &(arg)); ++(
ix))
4653 {
4654 if (error_operand_p (arg))
4655 return NULL__null;
4656 else if (VOID_TYPE_P (TREE_TYPE (arg))(((enum tree_code) (((contains_struct_check ((arg), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4656, __FUNCTION__))->typed.type))->base.code) == VOID_TYPE
)
)
4657 {
4658 if (complain & tf_error)
4659 error_at (cp_expr_loc_or_input_loc (arg),
4660 "invalid use of void expression");
4661 return NULL__null;
4662 }
4663 else if (invalid_nonstatic_memfn_p (EXPR_LOCATION (arg)((((arg)) && ((tree_code_type[(int) (((enum tree_code
) ((arg))->base.code))]) >= tcc_reference && (tree_code_type
[(int) (((enum tree_code) ((arg))->base.code))]) <= tcc_expression
)) ? (arg)->exp.locus : ((location_t) 0))
, arg, complain))
4664 return NULL__null;
4665 }
4666 return args;
4667}
4668
4669/* Perform overload resolution on FN, which is called with the ARGS.
4670
4671 Return the candidate function selected by overload resolution, or
4672 NULL if the event that overload resolution failed. In the case
4673 that overload resolution fails, *CANDIDATES will be the set of
4674 candidates considered, and ANY_VIABLE_P will be set to true or
4675 false to indicate whether or not any of the candidates were
4676 viable.
4677
4678 The ARGS should already have gone through RESOLVE_ARGS before this
4679 function is called. */
4680
4681static struct z_candidate *
4682perform_overload_resolution (tree fn,
4683 const vec<tree, va_gc> *args,
4684 struct z_candidate **candidates,
4685 bool *any_viable_p, tsubst_flags_t complain)
4686{
4687 struct z_candidate *cand;
4688 tree explicit_targs;
4689 int template_only;
4690
4691 bool subtime = timevar_cond_start (TV_OVERLOAD);
4692
4693 explicit_targs = NULL_TREE(tree) __null;
4694 template_only = 0;
4695
4696 *candidates = NULL__null;
4697 *any_viable_p = true;
4698
4699 /* Check FN. */
4700 gcc_assert (OVL_P (fn) || TREE_CODE (fn) == TEMPLATE_ID_EXPR)((void)(!((((enum tree_code) (fn)->base.code) == FUNCTION_DECL
|| ((enum tree_code) (fn)->base.code) == OVERLOAD) || ((enum
tree_code) (fn)->base.code) == TEMPLATE_ID_EXPR) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4700, __FUNCTION__), 0 : 0))
;
4701
4702 if (TREE_CODE (fn)((enum tree_code) (fn)->base.code) == TEMPLATE_ID_EXPR)
4703 {
4704 explicit_targs = TREE_OPERAND (fn, 1)(*((const_cast<tree*> (tree_operand_check ((fn), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4704, __FUNCTION__)))))
;
4705 fn = TREE_OPERAND (fn, 0)(*((const_cast<tree*> (tree_operand_check ((fn), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4705, __FUNCTION__)))))
;
4706 template_only = 1;
4707 }
4708
4709 /* Add the various candidate functions. */
4710 add_candidates (fn, NULL_TREE(tree) __null, args, NULL_TREE(tree) __null,
4711 explicit_targs, template_only,
4712 /*conversion_path=*/NULL_TREE(tree) __null,
4713 /*access_path=*/NULL_TREE(tree) __null,
4714 LOOKUP_NORMAL((1 << 0)),
4715 candidates, complain);
4716
4717 *candidates = splice_viable (*candidates, false, any_viable_p);
4718 if (*any_viable_p)
4719 cand = tourney (*candidates, complain);
4720 else
4721 cand = NULL__null;
4722
4723 timevar_cond_stop (TV_OVERLOAD, subtime);
4724 return cand;
4725}
4726
4727/* Print an error message about being unable to build a call to FN with
4728 ARGS. ANY_VIABLE_P indicates whether any candidate functions could
4729 be located; CANDIDATES is a possibly empty list of such
4730 functions. */
4731
4732static void
4733print_error_for_call_failure (tree fn, const vec<tree, va_gc> *args,
4734 struct z_candidate *candidates)
4735{
4736 tree targs = NULL_TREE(tree) __null;
4737 if (TREE_CODE (fn)((enum tree_code) (fn)->base.code) == TEMPLATE_ID_EXPR)
4738 {
4739 targs = TREE_OPERAND (fn, 1)(*((const_cast<tree*> (tree_operand_check ((fn), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4739, __FUNCTION__)))))
;
4740 fn = TREE_OPERAND (fn, 0)(*((const_cast<tree*> (tree_operand_check ((fn), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4740, __FUNCTION__)))))
;
4741 }
4742 tree name = OVL_NAME (fn)((contains_struct_check ((ovl_first (fn)), (TS_DECL_MINIMAL),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4742, __FUNCTION__))->decl_minimal.name)
;
4743 location_t loc = location_of (name);
4744 if (targs)
4745 name = lookup_template_function (name, targs);
4746
4747 auto_diagnostic_group d;
4748 if (!any_strictly_viable (candidates))
4749 error_at (loc, "no matching function for call to %<%D(%A)%>",
4750 name, build_tree_list_vec (args));
4751 else
4752 error_at (loc, "call of overloaded %<%D(%A)%> is ambiguous",
4753 name, build_tree_list_vec (args));
4754 if (candidates)
4755 print_z_candidates (loc, candidates);
4756}
4757
4758/* Perform overload resolution on the set of deduction guides DGUIDES
4759 using ARGS. Returns the selected deduction guide, or error_mark_node
4760 if overload resolution fails. */
4761
4762tree
4763perform_dguide_overload_resolution (tree dguides, const vec<tree, va_gc> *args,
4764 tsubst_flags_t complain)
4765{
4766 z_candidate *candidates;
4767 bool any_viable_p;
4768 tree result;
4769
4770 gcc_assert (deduction_guide_p (OVL_FIRST (dguides)))((void)(!(deduction_guide_p (ovl_first (dguides))) ? fancy_abort
("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4770, __FUNCTION__), 0 : 0))
;
4771
4772 /* Get the high-water mark for the CONVERSION_OBSTACK. */
4773 void *p = conversion_obstack_alloc (0);
4774
4775 z_candidate *cand = perform_overload_resolution (dguides, args, &candidates,
4776 &any_viable_p, complain);
4777 if (!cand)
4778 {
4779 if (complain & tf_error)
4780 print_error_for_call_failure (dguides, args, candidates);
4781 result = error_mark_nodeglobal_trees[TI_ERROR_MARK];
4782 }
4783 else
4784 result = cand->fn;
4785
4786 /* Free all the conversions we allocated. */
4787 obstack_free (&conversion_obstack, p)__extension__ ({ struct obstack *__o = (&conversion_obstack
); void *__obj = (void *) (p); if (__obj > (void *) __o->
chunk && __obj < (void *) __o->chunk_limit) __o
->next_free = __o->object_base = (char *) __obj; else _obstack_free
(__o, __obj); })
;
4788
4789 return result;
4790}
4791
4792/* Return an expression for a call to FN (a namespace-scope function,
4793 or a static member function) with the ARGS. This may change
4794 ARGS. */
4795
4796tree
4797build_new_function_call (tree fn, vec<tree, va_gc> **args,
4798 tsubst_flags_t complain)
4799{
4800 struct z_candidate *candidates, *cand;
4801 bool any_viable_p;
4802 void *p;
4803 tree result;
4804
4805 if (args != NULL__null && *args != NULL__null)
4806 {
4807 *args = resolve_args (*args, complain);
4808 if (*args == NULL__null)
4809 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4810 }
4811
4812 if (flag_tmglobal_options.x_flag_tm)
4813 tm_malloc_replacement (fn);
4814
4815 /* Get the high-water mark for the CONVERSION_OBSTACK. */
4816 p = conversion_obstack_alloc (0);
4817
4818 cand = perform_overload_resolution (fn, *args, &candidates, &any_viable_p,
4819 complain);
4820
4821 if (!cand)
4822 {
4823 if (complain & tf_error)
4824 {
4825 // If there is a single (non-viable) function candidate,
4826 // let the error be diagnosed by cp_build_function_call_vec.
4827 if (!any_viable_p && candidates && ! candidates->next
4828 && (TREE_CODE (candidates->fn)((enum tree_code) (candidates->fn)->base.code) == FUNCTION_DECL))
4829 return cp_build_function_call_vec (candidates->fn, args, complain);
4830
4831 // Otherwise, emit notes for non-viable candidates.
4832 print_error_for_call_failure (fn, *args, candidates);
4833 }
4834 result = error_mark_nodeglobal_trees[TI_ERROR_MARK];
4835 }
4836 else
4837 {
4838 result = build_over_call (cand, LOOKUP_NORMAL((1 << 0)), complain);
4839 }
4840
4841 if (flag_coroutinesglobal_options.x_flag_coroutines
4842 && result
4843 && TREE_CODE (result)((enum tree_code) (result)->base.code) == CALL_EXPR
4844 && DECL_BUILT_IN_CLASS (TREE_OPERAND (CALL_EXPR_FN (result), 0))((built_in_class) (tree_check (((*((const_cast<tree*> (
tree_operand_check (((*((const_cast<tree*> (tree_operand_check
(((tree_check ((result), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4844, __FUNCTION__, (CALL_EXPR)))), (1), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4844, __FUNCTION__)))))), (0), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4844, __FUNCTION__)))))), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4844, __FUNCTION__, (FUNCTION_DECL)))->function_decl.built_in_class
)
4845 == BUILT_IN_NORMAL)
4846 result = coro_validate_builtin_call (result);
4847
4848 /* Free all the conversions we allocated. */
4849 obstack_free (&conversion_obstack, p)__extension__ ({ struct obstack *__o = (&conversion_obstack
); void *__obj = (void *) (p); if (__obj > (void *) __o->
chunk && __obj < (void *) __o->chunk_limit) __o
->next_free = __o->object_base = (char *) __obj; else _obstack_free
(__o, __obj); })
;
4850
4851 return result;
4852}
4853
4854/* Build a call to a global operator new. FNNAME is the name of the
4855 operator (either "operator new" or "operator new[]") and ARGS are
4856 the arguments provided. This may change ARGS. *SIZE points to the
4857 total number of bytes required by the allocation, and is updated if
4858 that is changed here. *COOKIE_SIZE is non-NULL if a cookie should
4859 be used. If this function determines that no cookie should be
4860 used, after all, *COOKIE_SIZE is set to NULL_TREE. If SIZE_CHECK
4861 is not NULL_TREE, it is evaluated before calculating the final
4862 array size, and if it fails, the array size is replaced with
4863 (size_t)-1 (usually triggering a std::bad_alloc exception). If FN
4864 is non-NULL, it will be set, upon return, to the allocation
4865 function called. */
4866
4867tree
4868build_operator_new_call (tree fnname, vec<tree, va_gc> **args,
4869 tree *size, tree *cookie_size,
4870 tree align_arg, tree size_check,
4871 tree *fn, tsubst_flags_t complain)
4872{
4873 tree original_size = *size;
4874 tree fns;
4875 struct z_candidate *candidates;
4876 struct z_candidate *cand = NULL__null;
4877 bool any_viable_p;
4878
4879 if (fn)
1
Assuming 'fn' is null
2
Taking false branch
4880 *fn = NULL_TREE(tree) __null;
4881 /* Set to (size_t)-1 if the size check fails. */
4882 if (size_check != NULL_TREE(tree) __null)
3
Assuming 'size_check' is equal to NULL_TREE
4
Taking false branch
4883 {
4884 tree errval = TYPE_MAX_VALUE (sizetype)((tree_check5 ((sizetype_tab[(int) stk_sizetype]), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4884, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE
), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval
)
;
4885 if (cxx_dialect >= cxx11 && flag_exceptionsglobal_options.x_flag_exceptions)
4886 errval = throw_bad_array_new_length ();
4887 *size = fold_build3 (COND_EXPR, sizetype, size_check,fold_build3_loc (((location_t) 0), COND_EXPR, sizetype_tab[(int
) stk_sizetype], size_check, original_size, errval )
4888 original_size, errval)fold_build3_loc (((location_t) 0), COND_EXPR, sizetype_tab[(int
) stk_sizetype], size_check, original_size, errval )
;
4889 }
4890 vec_safe_insert (*args, 0, *size);
5
Passing value via 1st parameter 'v'
6
Calling 'vec_safe_insert<tree_node *, va_gc>'
4891 *args = resolve_args (*args, complain);
4892 if (*args == NULL__null)
4893 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4894
4895 /* Based on:
4896
4897 [expr.new]
4898
4899 If this lookup fails to find the name, or if the allocated type
4900 is not a class type, the allocation function's name is looked
4901 up in the global scope.
4902
4903 we disregard block-scope declarations of "operator new". */
4904 fns = lookup_name (fnname, LOOK_where::NAMESPACE);
4905 fns = lookup_arg_dependent (fnname, fns, *args);
4906
4907 if (align_arg)
4908 {
4909 vec<tree, va_gc>* align_args
4910 = vec_copy_and_insert (*args, align_arg, 1);
4911 cand = perform_overload_resolution (fns, align_args, &candidates,
4912 &any_viable_p, tf_none);
4913 if (cand)
4914 *args = align_args;
4915 /* If no aligned allocation function matches, try again without the
4916 alignment. */
4917 }
4918
4919 /* Figure out what function is being called. */
4920 if (!cand)
4921 cand = perform_overload_resolution (fns, *args, &candidates, &any_viable_p,
4922 complain);
4923
4924 /* If no suitable function could be found, issue an error message
4925 and give up. */
4926 if (!cand)
4927 {
4928 if (complain & tf_error)
4929 print_error_for_call_failure (fns, *args, candidates);
4930 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
4931 }
4932
4933 /* If a cookie is required, add some extra space. Whether
4934 or not a cookie is required cannot be determined until
4935 after we know which function was called. */
4936 if (*cookie_size)
4937 {
4938 bool use_cookie = true;
4939 tree arg_types;
4940
4941 arg_types = TYPE_ARG_TYPES (TREE_TYPE (cand->fn))((tree_check2 ((((contains_struct_check ((cand->fn), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4941, __FUNCTION__))->typed.type)), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4941, __FUNCTION__, (FUNCTION_TYPE), (METHOD_TYPE)))->type_non_common
.values)
;
4942 /* Skip the size_t parameter. */
4943 arg_types = TREE_CHAIN (arg_types)((contains_struct_check ((arg_types), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4943, __FUNCTION__))->common.chain)
;
4944 /* Check the remaining parameters (if any). */
4945 if (arg_types
4946 && TREE_CHAIN (arg_types)((contains_struct_check ((arg_types), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4946, __FUNCTION__))->common.chain)
== void_list_nodeglobal_trees[TI_VOID_LIST_NODE]
4947 && same_type_p (TREE_VALUE (arg_types),comptypes ((((tree_check ((arg_types), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4947, __FUNCTION__, (TREE_LIST)))->list.value)), (global_trees
[TI_PTR_TYPE]), 0)
4948 ptr_type_node)comptypes ((((tree_check ((arg_types), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4947, __FUNCTION__, (TREE_LIST)))->list.value)), (global_trees
[TI_PTR_TYPE]), 0)
)
4949 use_cookie = false;
4950 /* If we need a cookie, adjust the number of bytes allocated. */
4951 if (use_cookie)
4952 {
4953 /* Update the total size. */
4954 *size = size_binop (PLUS_EXPR, original_size, *cookie_size)size_binop_loc (((location_t) 0), PLUS_EXPR, original_size, *
cookie_size)
;
4955 if (size_check)
4956 {
4957 /* Set to (size_t)-1 if the size check fails. */
4958 gcc_assert (size_check != NULL_TREE)((void)(!(size_check != (tree) __null) ? fancy_abort ("/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4958, __FUNCTION__), 0 : 0))
;
4959 *size = fold_build3 (COND_EXPR, sizetype, size_check,fold_build3_loc (((location_t) 0), COND_EXPR, sizetype_tab[(int
) stk_sizetype], size_check, *size, ((tree_check5 ((sizetype_tab
[(int) stk_sizetype]), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4960, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE
), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval
) )
4960 *size, TYPE_MAX_VALUE (sizetype))fold_build3_loc (((location_t) 0), COND_EXPR, sizetype_tab[(int
) stk_sizetype], size_check, *size, ((tree_check5 ((sizetype_tab
[(int) stk_sizetype]), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4960, __FUNCTION__, (INTEGER_TYPE), (ENUMERAL_TYPE), (BOOLEAN_TYPE
), (REAL_TYPE), (FIXED_POINT_TYPE)))->type_non_common.maxval
) )
;
4961 }
4962 /* Update the argument list to reflect the adjusted size. */
4963 (**args)[0] = *size;
4964 }
4965 else
4966 *cookie_size = NULL_TREE(tree) __null;
4967 }
4968
4969 /* Tell our caller which function we decided to call. */
4970 if (fn)
4971 *fn = cand->fn;
4972
4973 /* Build the CALL_EXPR. */
4974 tree ret = build_over_call (cand, LOOKUP_NORMAL((1 << 0)), complain);
4975
4976 /* Set this flag for all callers of this function. In addition to
4977 new-expressions, this is called for allocating coroutine state; treat
4978 that as an implicit new-expression. */
4979 tree call = extract_call_expr (ret);
4980 if (TREE_CODE (call)((enum tree_code) (call)->base.code) == CALL_EXPR)
4981 CALL_FROM_NEW_OR_DELETE_P (call)((tree_check ((call), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 4981, __FUNCTION__, (CALL_EXPR)))->base.protected_flag)
= 1;
4982
4983 return ret;
4984}
4985
4986/* Build a new call to operator(). This may change ARGS. */
4987
4988static tree
4989build_op_call_1 (tree obj, vec<tree, va_gc> **args, tsubst_flags_t complain)
4990{
4991 struct z_candidate *candidates = 0, *cand;
4992 tree fns, convs, first_mem_arg = NULL_TREE(tree) __null;
4993 bool any_viable_p;
4994 tree result = NULL_TREE(tree) __null;
4995 void *p;
4996
4997 obj = mark_lvalue_use (obj);
4998
4999 if (error_operand_p (obj))
5000 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
5001
5002 tree type = TREE_TYPE (obj)((contains_struct_check ((obj), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5002, __FUNCTION__))->typed.type)
;
5003
5004 obj = prep_operand (obj);
5005
5006 if (TYPE_PTRMEMFUNC_P (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/call.c"
, 5006, __FUNCTION__, (RECORD_TYPE)))), (tcc_type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5006, __FUNCTION__))->type_common.lang_flag_2)))
)
5007 {
5008 if (complain & tf_error)
5009 /* It's no good looking for an overloaded operator() on a
5010 pointer-to-member-function. */
5011 error ("pointer-to-member function %qE cannot be called without "
5012 "an object; consider using %<.*%> or %<->*%>", obj);
5013 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
5014 }
5015
5016 if (TYPE_BINFO (type)((tree_check3 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5016, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
)
5017 {
5018 fns = lookup_fnfields (TYPE_BINFO (type)((tree_check3 ((type), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5018, __FUNCTION__, (RECORD_TYPE), (UNION_TYPE), (QUAL_UNION_TYPE
)))->type_non_common.maxval)
, call_op_identifier(ovl_op_info[false][OVL_OP_CALL_EXPR].identifier), 1, complain);
5019 if (fns == error_mark_nodeglobal_trees[TI_ERROR_MARK])
5020 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
5021 }
5022 else
5023 fns = NULL_TREE(tree) __null;
5024
5025 if (args != NULL__null && *args != NULL__null)
5026 {
5027 *args = resolve_args (*args, complain);
5028 if (*args == NULL__null)
5029 return error_mark_nodeglobal_trees[TI_ERROR_MARK];
5030 }
5031
5032 /* Get the high-water mark for the CONVERSION_OBSTACK. */
5033 p = conversion_obstack_alloc (0);
5034
5035 if (fns)
5036 {
5037 first_mem_arg = obj;
5038
5039 add_candidates (BASELINK_FUNCTIONS (fns)(((struct tree_baselink*) (tree_check ((fns), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5039, __FUNCTION__, (BASELINK))))->functions)
,
5040 first_mem_arg, *args, NULL_TREE(tree) __null,
5041 NULL_TREE(tree) __null, false,
5042 BASELINK_BINFO (fns)(((struct tree_baselink*) (tree_check ((fns), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5042, __FUNCTION__, (BASELINK))))->binfo)
, BASELINK_ACCESS_BINFO (fns)(((struct tree_baselink*) (tree_check ((fns), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5042, __FUNCTION__, (BASELINK))))->access_binfo)
,
5043 LOOKUP_NORMAL((1 << 0)), &candidates, complain);
5044 }
5045
5046 convs = lookup_conversions (type);
5047
5048 for (; convs; convs = TREE_CHAIN (convs)((contains_struct_check ((convs), (TS_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5048, __FUNCTION__))->common.chain)
)
5049 {
5050 tree totype = TREE_TYPE (convs)((contains_struct_check ((convs), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5050, __FUNCTION__))->typed.type)
;
5051
5052 if (TYPE_PTRFN_P (totype)((((enum tree_code) (totype)->base.code) == POINTER_TYPE) &&
((enum tree_code) (((contains_struct_check ((totype), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5052, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
)
5053 || TYPE_REFFN_P (totype)((((enum tree_code) (totype)->base.code) == REFERENCE_TYPE
) && ((enum tree_code) (((contains_struct_check ((totype
), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5053, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
)
5054 || (TYPE_REF_P (totype)(((enum tree_code) (totype)->base.code) == REFERENCE_TYPE)
5055 && TYPE_PTRFN_P (TREE_TYPE (totype))((((enum tree_code) (((contains_struct_check ((totype), (TS_TYPED
), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5055, __FUNCTION__))->typed.type))->base.code) == POINTER_TYPE
) && ((enum tree_code) (((contains_struct_check ((((contains_struct_check
((totype), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5055, __FUNCTION__))->typed.type)), (TS_TYPED), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5055, __FUNCTION__))->typed.type))->base.code) == FUNCTION_TYPE
)
))
5056 for (tree fn : ovl_range (TREE_VALUE (convs)((tree_check ((convs), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5056, __FUNCTION__, (TREE_LIST)))->list.value)
))
5057 {
5058 if (DECL_NONCONVERTING_P (fn)(__extension__ ({ struct lang_decl *lt = ((contains_struct_check
(((((enum tree_code) (fn)->base.code) == TEMPLATE_DECL ? (
(struct tree_template_decl *)(const_cast<union tree_node *
> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5058, __FUNCTION__, (TEMPLATE_DECL))))))))->result : fn)
), (TS_DECL_COMMON), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5058, __FUNCTION__))->decl_common.lang_specific); if (!(
((enum tree_code) (fn)->base.code) == FUNCTION_DECL || (((
enum tree_code) (fn)->base.code) == TEMPLATE_DECL &&
((struct tree_template_decl *)(const_cast<union tree_node
*> ((((tree_check ((fn), "/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5058, __FUNCTION__, (TEMPLATE_DECL))))))))->result != (tree
) __null && ((enum tree_code) (((struct tree_template_decl
*)(const_cast<union tree_node *> ((((tree_check ((fn),
"/home/marxin/BIG/buildbot/buildworker/marxinbox-gcc-clang-static-analyzer/build/gcc/cp/call.c"
, 5058, __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/call.c"
, 5058, __FUNCTION__); &lt->u.fn; })->nonconverting
)
)
5059 continue;
5060
5061 if (TREE_CODE (fn)((enum tree_code) (fn)->base.code) == TEMPLATE_DECL)
5062 add_template_conv_candidate
5063 (&candidates, fn, obj, *args, totype,
5064 /*access_path=*/NULL_TREE(tree) __null,
5065 /*conversion_path=*/NULL_TREE(tree) __null, complain);
5066 else
5067 add_conv_candidate (&candidates, fn, obj,
5068