public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107545] New: __is_abstract intrinsic fails to compile on incomplete unions
@ 2022-11-07  2:41 eric41293 at comcast dot net
  2022-11-07  4:42 ` [Bug c++/107545] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: eric41293 at comcast dot net @ 2022-11-07  2:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107545
           Summary: __is_abstract intrinsic fails to compile on incomplete
                    unions
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eric41293 at comcast dot net
  Target Milestone: ---

[meta.unary.props] states for std::is_abstract, "If T is a non-union class
type, T shall be a complete type." A union cannot have virtual functions, so an
incomplete union can safely be determined not to be abstract. Thus, is_abstract
is required to work for incomplete unions. However, the __is_abstract
intrinsic, and hence also std::is_abstract, generates a compiler error in this
case:

$ g++ --version
g++ (Ubuntu 12.1.0-2ubuntu1~22.04) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat > is_abstract.cpp
union U;
bool b = __is_abstract(U);
$ g++ is_abstract.cpp
is_abstract.cpp:2:25: error: invalid use of incomplete type ‘union U’
    2 | bool b = __is_abstract(U);
      |                         ^
is_abstract.cpp:1:7: note: forward declaration of ‘union U’
    1 | union U;
      |       ^

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

* [Bug c++/107545] __is_abstract intrinsic fails to compile on incomplete unions
  2022-11-07  2:41 [Bug c++/107545] New: __is_abstract intrinsic fails to compile on incomplete unions eric41293 at comcast dot net
@ 2022-11-07  4:42 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-07  4:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=106838

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed in GCC 13 most likely by the patch which fixed 106838.

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

end of thread, other threads:[~2022-11-07  4:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07  2:41 [Bug c++/107545] New: __is_abstract intrinsic fails to compile on incomplete unions eric41293 at comcast dot net
2022-11-07  4:42 ` [Bug c++/107545] " 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).