public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106759] New: __has_builtin doesn't report __is_nothrow_constructible as supported
@ 2022-08-26 20:38 nikolasklauser at berlin dot de
  2022-08-26 21:03 ` [Bug c++/106759] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: nikolasklauser at berlin dot de @ 2022-08-26 20:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106759
           Summary: __has_builtin doesn't report
                    __is_nothrow_constructible as supported
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nikolasklauser at berlin dot de
  Target Milestone: ---

__has_builtin normally reports if builtin type traits are supported, but
__has_builtin(__is_nothrow_constructible) is false.

Reproducer: (Godbolt: https://godbolt.org/z/T6d7M6jx7)

#if __has_builtin(__is_nothrow_constructible)
#  error "has builtin" // should error here, but doesn't
#endif

int main() { return __is_nothrow_constructible(int); }

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

* [Bug c++/106759] __has_builtin doesn't report __is_nothrow_constructible as supported
  2022-08-26 20:38 [Bug c++/106759] New: __has_builtin doesn't report __is_nothrow_constructible as supported nikolasklauser at berlin dot de
@ 2022-08-26 21:03 ` pinskia at gcc dot gnu.org
  2022-08-26 21:59 ` mpolacek at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-26 21:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-08-26

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
diff --git a/gcc/cp/cp-objcp-common.cc b/gcc/cp/cp-objcp-common.cc
index 4079a4b4aec..1ffac08c32f 100644
--- a/gcc/cp/cp-objcp-common.cc
+++ b/gcc/cp/cp-objcp-common.cc
@@ -460,6 +460,8 @@ names_builtin_p (const char *name)
     case RID_IS_UNION:
     case RID_IS_ASSIGNABLE:
     case RID_IS_CONSTRUCTIBLE:
+    case RID_IS_NOTHROW_ASSIGNABLE:
+    case RID_IS_NOTHROW_CONSTRUCTIBLE:
     case RID_UNDERLYING_TYPE:
     case RID_REF_CONSTRUCTS_FROM_TEMPORARY:
     case RID_REF_CONVERTS_FROM_TEMPORARY:

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

* [Bug c++/106759] __has_builtin doesn't report __is_nothrow_constructible as supported
  2022-08-26 20:38 [Bug c++/106759] New: __has_builtin doesn't report __is_nothrow_constructible as supported nikolasklauser at berlin dot de
  2022-08-26 21:03 ` [Bug c++/106759] " pinskia at gcc dot gnu.org
@ 2022-08-26 21:59 ` mpolacek at gcc dot gnu.org
  2022-08-26 22:13 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-08-26 21:59 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Are you going to post the patch or should I?

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

* [Bug c++/106759] __has_builtin doesn't report __is_nothrow_constructible as supported
  2022-08-26 20:38 [Bug c++/106759] New: __has_builtin doesn't report __is_nothrow_constructible as supported nikolasklauser at berlin dot de
  2022-08-26 21:03 ` [Bug c++/106759] " pinskia at gcc dot gnu.org
  2022-08-26 21:59 ` mpolacek at gcc dot gnu.org
@ 2022-08-26 22:13 ` pinskia at gcc dot gnu.org
  2022-08-26 22:16 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-26 22:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #2)
> Are you going to post the patch or should I?

Can you do it? I don't have time to add a testcase and to double check all of
the RIDs. I just did the few I saw.

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

* [Bug c++/106759] __has_builtin doesn't report __is_nothrow_constructible as supported
  2022-08-26 20:38 [Bug c++/106759] New: __has_builtin doesn't report __is_nothrow_constructible as supported nikolasklauser at berlin dot de
                   ` (2 preceding siblings ...)
  2022-08-26 22:13 ` pinskia at gcc dot gnu.org
@ 2022-08-26 22:16 ` mpolacek at gcc dot gnu.org
  2022-08-30 13:07 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-08-26 22:16 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Sure.

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

* [Bug c++/106759] __has_builtin doesn't report __is_nothrow_constructible as supported
  2022-08-26 20:38 [Bug c++/106759] New: __has_builtin doesn't report __is_nothrow_constructible as supported nikolasklauser at berlin dot de
                   ` (3 preceding siblings ...)
  2022-08-26 22:16 ` mpolacek at gcc dot gnu.org
@ 2022-08-30 13:07 ` cvs-commit at gcc dot gnu.org
  2022-08-30 14:05 ` cvs-commit at gcc dot gnu.org
  2022-08-30 14:06 ` mpolacek at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-08-30 13:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:fe915f35b7d8dc768a2b977c09aa02f933e1d1e9

commit r13-2277-gfe915f35b7d8dc768a2b977c09aa02f933e1d1e9
Author: Marek Polacek <polacek@redhat.com>
Date:   Mon Aug 29 16:54:05 2022 -0400

    c++: __has_builtin gives the wrong answer [PR106759]

    We've supported __is_nothrow_constructible since r11-4386, but
    names_builtin_p didn't know about it, so it gave the wrong answer for
     #if __has_builtin(__is_nothrow_constructible)
     ...
     #endif

    I've tested all C++-only built-ins and only two were missing.

            PR c++/106759

    gcc/cp/ChangeLog:

            * cp-objcp-common.cc (names_builtin_p): Handle
RID_IS_NOTHROW_ASSIGNABLE
            and RID_IS_NOTHROW_CONSTRUCTIBLE.

    gcc/testsuite/ChangeLog:

            * g++.dg/ext/has-builtin-1.C: New test.

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

* [Bug c++/106759] __has_builtin doesn't report __is_nothrow_constructible as supported
  2022-08-26 20:38 [Bug c++/106759] New: __has_builtin doesn't report __is_nothrow_constructible as supported nikolasklauser at berlin dot de
                   ` (4 preceding siblings ...)
  2022-08-30 13:07 ` cvs-commit at gcc dot gnu.org
@ 2022-08-30 14:05 ` cvs-commit at gcc dot gnu.org
  2022-08-30 14:06 ` mpolacek at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-08-30 14:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:29dfe1cacadd2a47b4e5b1cab11bd7263fe211c9

commit r12-8729-g29dfe1cacadd2a47b4e5b1cab11bd7263fe211c9
Author: Marek Polacek <polacek@redhat.com>
Date:   Mon Aug 29 16:54:05 2022 -0400

    c++: __has_builtin gives the wrong answer [PR106759]

    We've supported __is_nothrow_constructible since r11-4386, but
    names_builtin_p didn't know about it, so it gave the wrong answer for
     #if __has_builtin(__is_nothrow_constructible)
     ...
     #endif

    I've tested all C++-only built-ins and only two were missing.

            PR c++/106759

    gcc/cp/ChangeLog:

            * cp-objcp-common.cc (names_builtin_p): Handle
RID_IS_NOTHROW_ASSIGNABLE
            and RID_IS_NOTHROW_CONSTRUCTIBLE.

    gcc/testsuite/ChangeLog:

            * g++.dg/ext/has-builtin-1.C: New test.

    (cherry picked from commit fe915f35b7d8dc768a2b977c09aa02f933e1d1e9)

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

* [Bug c++/106759] __has_builtin doesn't report __is_nothrow_constructible as supported
  2022-08-26 20:38 [Bug c++/106759] New: __has_builtin doesn't report __is_nothrow_constructible as supported nikolasklauser at berlin dot de
                   ` (5 preceding siblings ...)
  2022-08-30 14:05 ` cvs-commit at gcc dot gnu.org
@ 2022-08-30 14:06 ` mpolacek at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-08-30 14:06 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed for GCC 13 and 12.3.

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

end of thread, other threads:[~2022-08-30 14:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26 20:38 [Bug c++/106759] New: __has_builtin doesn't report __is_nothrow_constructible as supported nikolasklauser at berlin dot de
2022-08-26 21:03 ` [Bug c++/106759] " pinskia at gcc dot gnu.org
2022-08-26 21:59 ` mpolacek at gcc dot gnu.org
2022-08-26 22:13 ` pinskia at gcc dot gnu.org
2022-08-26 22:16 ` mpolacek at gcc dot gnu.org
2022-08-30 13:07 ` cvs-commit at gcc dot gnu.org
2022-08-30 14:05 ` cvs-commit at gcc dot gnu.org
2022-08-30 14:06 ` mpolacek 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).