public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109997] New: __is_assignable(int, IncompleteType) should be rejected
@ 2023-05-26 18:01 redi at gcc dot gnu.org
  2023-05-26 18:22 ` [Bug c++/109997] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2023-05-26 18:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109997
           Summary: __is_assignable(int, IncompleteType) should be
                    rejected
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
            Blocks: 71579
  Target Milestone: ---

struct S;
bool b = __is_assignable(int, S);

This should be rejected:

The precondition for std::is_assignable is:

"T and U shall be complete types, cv void, or arrays of unknown bound."


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71579
[Bug 71579] type_traits miss checks for type completeness in some traits

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

* [Bug c++/109997] __is_assignable(int, IncompleteType) should be rejected
  2023-05-26 18:01 [Bug c++/109997] New: __is_assignable(int, IncompleteType) should be rejected redi at gcc dot gnu.org
@ 2023-05-26 18:22 ` mpolacek at gcc dot gnu.org
  2023-05-26 21:34 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-05-26 18:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2023-05-26
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Same for std::is_constructible.  So presumably we want something like

--- a/gcc/cp/method.cc
+++ b/gcc/cp/method.cc
@@ -2173,7 +2173,10 @@ constructible_expr (tree to, tree from)
 static tree
 is_xible_helper (enum tree_code code, tree to, tree from, bool trivial)
 {
-  to = complete_type (to);
+  to = complete_type_or_else (to, NULL_TREE);
+  from = complete_type_or_else (from, NULL_TREE);
+  if (!from || !to)
+    return error_mark_node;
   deferring_access_check_sentinel acs (dk_no_deferred);
   if (VOID_TYPE_P (to) || ABSTRACT_CLASS_TYPE_P (to)
       || (from && FUNC_OR_METHOD_TYPE_P (from)

but I'd have to test std::is_constructible with a parameter pack as well.

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

* [Bug c++/109997] __is_assignable(int, IncompleteType) should be rejected
  2023-05-26 18:01 [Bug c++/109997] New: __is_assignable(int, IncompleteType) should be rejected redi at gcc dot gnu.org
  2023-05-26 18:22 ` [Bug c++/109997] " mpolacek at gcc dot gnu.org
@ 2023-05-26 21:34 ` pinskia at gcc dot gnu.org
  2023-05-26 21:35 ` pinskia at gcc dot gnu.org
  2023-05-26 21:37 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-26 21:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=92067

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Isn't this a dup of bug 92067?

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

* [Bug c++/109997] __is_assignable(int, IncompleteType) should be rejected
  2023-05-26 18:01 [Bug c++/109997] New: __is_assignable(int, IncompleteType) should be rejected redi at gcc dot gnu.org
  2023-05-26 18:22 ` [Bug c++/109997] " mpolacek at gcc dot gnu.org
  2023-05-26 21:34 ` pinskia at gcc dot gnu.org
@ 2023-05-26 21:35 ` pinskia at gcc dot gnu.org
  2023-05-26 21:37 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-26 21:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> Isn't this a dup of bug 92067?

Sorry I mean is_constructible is recorded as PR 92067. I was reading some other
bug headline and getting confused.

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

* [Bug c++/109997] __is_assignable(int, IncompleteType) should be rejected
  2023-05-26 18:01 [Bug c++/109997] New: __is_assignable(int, IncompleteType) should be rejected redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-05-26 21:35 ` pinskia at gcc dot gnu.org
@ 2023-05-26 21:37 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2023-05-26 21:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Looks pretty similar, although I don't think we even had __is_assignable when
that was filed.

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

end of thread, other threads:[~2023-05-26 21:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26 18:01 [Bug c++/109997] New: __is_assignable(int, IncompleteType) should be rejected redi at gcc dot gnu.org
2023-05-26 18:22 ` [Bug c++/109997] " mpolacek at gcc dot gnu.org
2023-05-26 21:34 ` pinskia at gcc dot gnu.org
2023-05-26 21:35 ` pinskia at gcc dot gnu.org
2023-05-26 21:37 ` redi 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).