public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/92031] [9 Regression] Incorrect "taking address of r-value" error
[not found] <bug-92031-4@http.gcc.gnu.org/bugzilla/>
@ 2020-03-10 0:02 ` mpolacek at gcc dot gnu.org
2020-03-12 11:58 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-03-10 0:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92031
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[9/10 Regression] Incorrect |[9 Regression] Incorrect
|"taking address of r-value" |"taking address of r-value"
|error |error
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
commit d417b4f5414d9076300ab41974a14424f722688c
Author: Marek Polacek <polacek@redhat.com>
Date: Fri Feb 28 16:57:04 2020 -0500
c++: Fix convert_like in template [PR91465, PR93870, PR92031, PR94068]
The point of this patch is to fix the recurring problem of trees
generated by convert_like while processing a template that break when
substituting. For instance, when convert_like creates a CALL_EXPR
while in a template, substituting such a call breaks in finish_call_expr
because we have two 'this' arguments. Another problem is that we
can create &TARGET_EXPR<> and then fail when substituting because we're
taking the address of an rvalue. I've analyzed some of the already fixed
PRs and also some of the currently open ones:
In c++/93870 we create EnumWrapper<E>::operator E(&operator~(E)).
In c++/87145 we create S::operator int (&{N}).
In c++/92031 we create &TARGET_EXPR <0>.
The gist of the problem is when convert_like_real creates a call for
a ck_user or wraps a TARGET_EXPR in & in a template. So in these cases
use IMPLICIT_CONV_EXPR. In a template we shouldn't need to perform the
actual conversion, we only need it's result type.
perform_direct_initialization_if_possible and
perform_implicit_conversion_flags can also create an IMPLICIT_CONV_EXPR.
Given the change above, build_converted_constant_expr can return an
IMPLICIT_CONV_EXPR so call fold_non_dependent_expr rather than
maybe_constant_value to deal with that.
To avoid the problem of instantiating something twice in a row I'm
removing a call to instantiate_non_dependent_expr_sfinae in
compute_array_index_type_loc. And the build_converted_constant_expr
pattern can now be simplified.
2020-03-09 Marek Polacek <polacek@redhat.com>
PR c++/92031 - bogus taking address of rvalue error.
PR c++/91465 - ICE with template codes in check_narrowing.
PR c++/93870 - wrong error when converting template non-type arg.
PR c++/94068 - ICE with template codes in check_narrowing.
* call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
in a template when not ck_identity and we're dealing with a class.
(convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
in a template if we need a temporary.
* decl.c (compute_array_index_type_loc): Remove
instantiate_non_dependent_expr_sfinae call. Call
fold_non_dependent_expr instead of maybe_constant_value.
(build_explicit_specifier): Don't instantiate or create a sentinel
before converting the expression.
* except.c (build_noexcept_spec): Likewise.
* pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
build_converted_constant_expr returned.
* typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
of maybe_constant_value.
* g++.dg/cpp0x/conv-tmpl2.C: New test.
* g++.dg/cpp0x/conv-tmpl3.C: New test.
* g++.dg/cpp0x/conv-tmpl4.C: New test.
* g++.dg/cpp0x/conv-tmpl5.C: New test.
* g++.dg/cpp0x/conv-tmpl6.C: New test.
* g++.dg/cpp1z/conv-tmpl1.C: New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/92031] [9 Regression] Incorrect "taking address of r-value" error
[not found] <bug-92031-4@http.gcc.gnu.org/bugzilla/>
2020-03-10 0:02 ` [Bug c++/92031] [9 Regression] Incorrect "taking address of r-value" error mpolacek at gcc dot gnu.org
@ 2020-03-12 11:58 ` jakub at gcc dot gnu.org
2021-01-05 16:51 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-12 11:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92031
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|9.3 |9.4
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 9.3.0 has been released, adjusting target milestone.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/92031] [9 Regression] Incorrect "taking address of r-value" error
[not found] <bug-92031-4@http.gcc.gnu.org/bugzilla/>
2020-03-10 0:02 ` [Bug c++/92031] [9 Regression] Incorrect "taking address of r-value" error mpolacek at gcc dot gnu.org
2020-03-12 11:58 ` jakub at gcc dot gnu.org
@ 2021-01-05 16:51 ` mpolacek at gcc dot gnu.org
2021-04-19 14:24 ` chip.kerchner at ibm dot com
2021-08-12 2:11 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-01-05 16:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92031
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed in 10+.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/92031] [9 Regression] Incorrect "taking address of r-value" error
[not found] <bug-92031-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2021-01-05 16:51 ` mpolacek at gcc dot gnu.org
@ 2021-04-19 14:24 ` chip.kerchner at ibm dot com
2021-08-12 2:11 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 5+ messages in thread
From: chip.kerchner at ibm dot com @ 2021-04-19 14:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92031
Chip Kerchner <chip.kerchner at ibm dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |chip.kerchner at ibm dot com
--- Comment #5 from Chip Kerchner <chip.kerchner at ibm dot com> ---
Please backport this fix into 9.4 or 9.5.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/92031] [9 Regression] Incorrect "taking address of r-value" error
[not found] <bug-92031-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2021-04-19 14:24 ` chip.kerchner at ibm dot com
@ 2021-08-12 2:11 ` pinskia at gcc dot gnu.org
4 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-12 2:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92031
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|9.4 |10.0
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-08-12 2:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-92031-4@http.gcc.gnu.org/bugzilla/>
2020-03-10 0:02 ` [Bug c++/92031] [9 Regression] Incorrect "taking address of r-value" error mpolacek at gcc dot gnu.org
2020-03-12 11:58 ` jakub at gcc dot gnu.org
2021-01-05 16:51 ` mpolacek at gcc dot gnu.org
2021-04-19 14:24 ` chip.kerchner at ibm dot com
2021-08-12 2:11 ` pinskia at gcc dot gnu.org
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).