public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105509] New: [compatibility] f16 suffix not supported in C++ mode - unable to find numeric literal operator ‘operator""f16’
@ 2022-05-06 15:54 thiago at kde dot org
  2022-05-06 17:40 ` [Bug c++/105509] " hjl.tools at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: thiago at kde dot org @ 2022-05-06 15:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105509
           Summary: [compatibility] f16 suffix not supported in C++ mode -
                    unable to find numeric literal operator
                    ‘operator""f16’
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thiago at kde dot org
  Target Milestone: ---

The following code:

_Float16 f = 12.34f16;

compiles as C in GCC12, and as both C and C++ with Clang 14 and ICX 2022.

But with GCC 12 as C++, it generates:

error: unable to find numeric literal operator ‘operator""f16’

See also https://wg21.link/p1467, notably section 5.10 Literal suffixes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/105509] [compatibility] f16 suffix not supported in C++ mode - unable to find numeric literal operator ‘operator""f16’
  2022-05-06 15:54 [Bug c++/105509] New: [compatibility] f16 suffix not supported in C++ mode - unable to find numeric literal operator ‘operator""f16’ thiago at kde dot org
@ 2022-05-06 17:40 ` hjl.tools at gmail dot com
  2022-05-06 17:44 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2022-05-06 17:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
_Float16 was added for AVX512FP16 as a C++ extention.  The fN suffixes were
added by

https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=c65699efcce48d68ef57ab3ce7fc5420fac5cbf9

which has

C++ note: no support for the new types or constant suffixes is added
for C++.  C++ decimal floating-point support was very different from
the C support, using class types, and the same may well apply to any
future C++ bindings for IEEE interchange and extended types.  There is
a case, however, for supporting at least *f128 constants in C++, so
that code using __float128 can use the newer style for constants
throughout rather than needing to use the older *q constants in C++.
Also, if built-in functions are added that may provide a way in which
the types could leak into C++ code.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/105509] [compatibility] f16 suffix not supported in C++ mode - unable to find numeric literal operator ‘operator""f16’
  2022-05-06 15:54 [Bug c++/105509] New: [compatibility] f16 suffix not supported in C++ mode - unable to find numeric literal operator ‘operator""f16’ thiago at kde dot org
  2022-05-06 17:40 ` [Bug c++/105509] " hjl.tools at gmail dot com
@ 2022-05-06 17:44 ` redi at gcc dot gnu.org
  2022-05-09  8:00 ` rguenth at gcc dot gnu.org
  2022-12-09 15:20 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2022-05-06 17:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Thiago Macieira from comment #0)
> See also https://wg21.link/p1467, notably section 5.10 Literal suffixes

That isn't supported yet *at all*. And it's not in the C++ draft yet.

The current support in G++ is just "some of the C stuff as an extension", not
an attempt to implement P1467. We will need the f16 suffix for C++23 eventually
though.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/105509] [compatibility] f16 suffix not supported in C++ mode - unable to find numeric literal operator ‘operator""f16’
  2022-05-06 15:54 [Bug c++/105509] New: [compatibility] f16 suffix not supported in C++ mode - unable to find numeric literal operator ‘operator""f16’ thiago at kde dot org
  2022-05-06 17:40 ` [Bug c++/105509] " hjl.tools at gmail dot com
  2022-05-06 17:44 ` redi at gcc dot gnu.org
@ 2022-05-09  8:00 ` rguenth at gcc dot gnu.org
  2022-12-09 15:20 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-09  8:00 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
           Keywords|                            |rejects-valid

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/105509] [compatibility] f16 suffix not supported in C++ mode - unable to find numeric literal operator ‘operator""f16’
  2022-05-06 15:54 [Bug c++/105509] New: [compatibility] f16 suffix not supported in C++ mode - unable to find numeric literal operator ‘operator""f16’ thiago at kde dot org
                   ` (2 preceding siblings ...)
  2022-05-09  8:00 ` rguenth at gcc dot gnu.org
@ 2022-12-09 15:20 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-09 15:20 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 106652. f16 was added for GCC 13.

*** This bug has been marked as a duplicate of bug 106652 ***

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-12-09 15:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06 15:54 [Bug c++/105509] New: [compatibility] f16 suffix not supported in C++ mode - unable to find numeric literal operator ‘operator""f16’ thiago at kde dot org
2022-05-06 17:40 ` [Bug c++/105509] " hjl.tools at gmail dot com
2022-05-06 17:44 ` redi at gcc dot gnu.org
2022-05-09  8:00 ` rguenth at gcc dot gnu.org
2022-12-09 15:20 ` 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).