public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/115511] ICE on ambigous overload for _Float32
Date: Mon, 17 Jun 2024 08:47:33 +0000	[thread overview]
Message-ID: <bug-115511-4-5cG7JYvw5x@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-115511-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115511

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Untested fix below.  I wasn't aware any targets would actually have float the
same as double.  C++23 says here:
http://eel.is/c++draft/conv.rank#2.2 that double has higher rank than float
http://eel.is/c++draft/conv.rank#2.5 and that extended type with same set of
values as 2+ standard types has same rank as double.  As I've only thought
about the double same as long double case, I've only handled that case there.
No testcase for testsuite, as this needs to be tested in avr/sh specific
g++.target only and needs proper options/effective target macros to find out if
that is really the float same as double configuration.  Will defer testcases to
the respective target maintainers.

2024-06-17  Jakub Jelinek  <jakub@redhat.com>

        PR target/111343
        PR c++/115511
        * typeck.cc (cp_compare_floating_point_conversion_ranks): If an
        extended floating point type mv1 has same set of values as more
        than one standard floating point type and mv2 is float, return 2.

--- gcc/cp/typeck.cc.jj 2024-06-04 13:19:03.755604346 +0200
+++ gcc/cp/typeck.cc    2024-06-17 10:32:02.063088961 +0200
@@ -393,6 +393,9 @@ cp_compare_floating_point_conversion_ran
      has higher rank.  */
   if (cnt > 1 && mv2 == long_double_type_node)
     return -2;
+  /* And similarly if t2 is float, t2 has lower rank.  */
+  if (cnt > 1 && mv2 == float_type_node)
+    return 2;
   /* Otherwise, they have equal rank, but extended types
      (other than std::bfloat16_t) have higher subrank.
      std::bfloat16_t shouldn't have equal rank to any standard

  parent reply	other threads:[~2024-06-17  8:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-16 14:06 [Bug c++/115511] New: " dv at vollmann dot ch
2024-06-16 14:18 ` [Bug c++/115511] " pinskia at gcc dot gnu.org
2024-06-17  5:45 ` dv at vollmann dot ch
2024-06-17  5:57 ` pinskia at gcc dot gnu.org
2024-06-17  8:47 ` jakub at gcc dot gnu.org [this message]
2024-06-17 10:32 ` dv at vollmann dot ch
2024-06-17 16:59 ` cvs-commit at gcc dot gnu.org
2024-06-17 17:19 ` cvs-commit at gcc dot gnu.org
2024-06-17 17:23 ` cvs-commit at gcc dot gnu.org

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=bug-115511-4-5cG7JYvw5x@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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: link
Be 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).