* [C++ Patch] tsubst_flags_t fixlet
@ 2018-02-14 11:01 Paolo Carlini
2018-02-14 13:44 ` Jason Merrill
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Carlini @ 2018-02-14 11:01 UTC (permalink / raw)
To: gcc-patches; +Cc: Jason Merrill
[-- Attachment #1: Type: text/plain, Size: 364 bytes --]
Hi,
today, while having a look to c++/84350, I noticed that in a couple of
places we aren't forwarding the tsubst_flags_t argument to
do_auto_deduction. I think we can elegantly solve the problem by
removing the do_auto_deduction overload taking three arguments and
adding two defaults to the other. Tested x86_64-linux.
Thanks, Paolo.
///////////////////
[-- Attachment #2: CL --]
[-- Type: text/plain, Size: 415 bytes --]
2018-02-14 Paolo Carlini <paolo.carlini@oracle.com>
* cp-tree.h (do_auto_deduction (tree, tree, tree)): Remove.
(do_auto_deduction (tree, tree, tree, tsubst_flags_t,
auto_deduction_context, tree, int): Add defaults.
* pt.c (do_auto_deduction (tree, tree, tree)): Remove definition.
(tsubst_omp_for_iterator): Adjust do_auto_deduction call, forward
tsubst_flags_t argument.
* init.c (build_new): Likewise.
[-- Attachment #3: patchlet --]
[-- Type: text/plain, Size: 2623 bytes --]
Index: cp-tree.h
===================================================================
--- cp-tree.h (revision 257653)
+++ cp-tree.h (working copy)
@@ -6470,10 +6470,11 @@ extern tree make_auto (void);
extern tree make_decltype_auto (void);
extern tree make_template_placeholder (tree);
extern bool template_placeholder_p (tree);
-extern tree do_auto_deduction (tree, tree, tree);
extern tree do_auto_deduction (tree, tree, tree,
- tsubst_flags_t,
- auto_deduction_context,
+ tsubst_flags_t
+ = tf_warning_or_error,
+ auto_deduction_context
+ = adc_unspecified,
tree = NULL_TREE,
int = LOOKUP_NORMAL);
extern tree type_uses_auto (tree);
Index: init.c
===================================================================
--- init.c (revision 257653)
+++ init.c (working copy)
@@ -3593,7 +3593,7 @@ build_new (vec<tree, va_gc> **placement, tree type
d_init = (**init)[0];
d_init = resolve_nondeduced_context (d_init, complain);
}
- type = do_auto_deduction (type, d_init, auto_node);
+ type = do_auto_deduction (type, d_init, auto_node, complain);
}
}
Index: pt.c
===================================================================
--- pt.c (revision 257653)
+++ pt.c (working copy)
@@ -15785,7 +15785,7 @@ tsubst_omp_for_iterator (tree t, int i, tree declv
tree auto_node = type_uses_auto (TREE_TYPE (decl));
if (auto_node && init)
TREE_TYPE (decl)
- = do_auto_deduction (TREE_TYPE (decl), init, auto_node);
+ = do_auto_deduction (TREE_TYPE (decl), init, auto_node, complain);
gcc_assert (!type_dependent_expression_p (decl));
@@ -25941,17 +25941,6 @@ do_class_deduction (tree ptype, tree tmpl, tree in
}
/* Replace occurrences of 'auto' in TYPE with the appropriate type deduced
- from INIT. AUTO_NODE is the TEMPLATE_TYPE_PARM used for 'auto' in TYPE. */
-
-tree
-do_auto_deduction (tree type, tree init, tree auto_node)
-{
- return do_auto_deduction (type, init, auto_node,
- tf_warning_or_error,
- adc_unspecified);
-}
-
-/* Replace occurrences of 'auto' in TYPE with the appropriate type deduced
from INIT. AUTO_NODE is the TEMPLATE_TYPE_PARM used for 'auto' in TYPE.
The CONTEXT determines the context in which auto deduction is performed
and is used to control error diagnostics. FLAGS are the LOOKUP_* flags.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [C++ Patch] tsubst_flags_t fixlet
2018-02-14 11:01 [C++ Patch] tsubst_flags_t fixlet Paolo Carlini
@ 2018-02-14 13:44 ` Jason Merrill
0 siblings, 0 replies; 2+ messages in thread
From: Jason Merrill @ 2018-02-14 13:44 UTC (permalink / raw)
To: Paolo Carlini; +Cc: gcc-patches
OK.
On Wed, Feb 14, 2018 at 6:01 AM, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> Hi,
>
> today, while having a look to c++/84350, I noticed that in a couple of
> places we aren't forwarding the tsubst_flags_t argument to
> do_auto_deduction. I think we can elegantly solve the problem by removing
> the do_auto_deduction overload taking three arguments and adding two
> defaults to the other. Tested x86_64-linux.
>
> Thanks, Paolo.
>
> ///////////////////
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-14 13:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-14 11:01 [C++ Patch] tsubst_flags_t fixlet Paolo Carlini
2018-02-14 13:44 ` Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).