public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-3193] c++: Set type on dependent ARROW_EXPR Date: Fri, 27 Aug 2021 21:40:27 +0000 (GMT) [thread overview] Message-ID: <20210827214027.644993858001@sourceware.org> (raw) https://gcc.gnu.org/g:771fd4aef999903cb928bb89f730c61a8af6e4f8 commit r12-3193-g771fd4aef999903cb928bb89f730c61a8af6e4f8 Author: Jason Merrill <jason@redhat.com> Date: Fri Aug 27 10:00:49 2021 -0400 c++: Set type on dependent ARROW_EXPR Even if the operand of -> has dependent type, if it's a pointer we know that the result will be the target type of that pointer. This should avoid some unnecessary TYPEOF_EXPR when looking up a name after ->. gcc/cp/ChangeLog: * typeck2.c (build_x_arrow): Do set TREE_TYPE when operand is a dependent pointer. Diff: --- gcc/cp/typeck2.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index dcfdff2f905..5e2c23c063c 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -1913,11 +1913,17 @@ build_x_arrow (location_t loc, tree expr, tsubst_flags_t complain) if (processing_template_decl) { - if (type && TYPE_PTR_P (type) - && !dependent_scope_p (TREE_TYPE (type))) + tree ttype = NULL_TREE; + if (type && TYPE_PTR_P (type)) + ttype = TREE_TYPE (type); + if (ttype && !dependent_scope_p (ttype)) /* Pointer to current instantiation, don't treat as dependent. */; else if (type_dependent_expression_p (expr)) - return build_min_nt_loc (loc, ARROW_EXPR, expr); + { + expr = build_min_nt_loc (loc, ARROW_EXPR, expr); + TREE_TYPE (expr) = ttype; + return expr; + } expr = build_non_dependent_expr (expr); }
reply other threads:[~2021-08-27 21:40 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210827214027.644993858001@sourceware.org \ --to=jason@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).