From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D21B33858D3C; Mon, 7 Nov 2022 02:41:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D21B33858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667788903; bh=lJecDaXsJYP2nQ3ZhUXubStFoYs8FQfnZqXAPhflbuA=; h=From:To:Subject:Date:From; b=LcMc9pG4/39sagI82aXLP3bTDY7QqegpvHKDkIlxE/EwecUfUI+qzqMy4Sn1s2I+E xrYfu4PTDWdh/8b3Uk1pR35v4Nqz9nEqVfX7ZHf5PixfGL3TP4nfxTWGt+WI4MzrLa vK51yv4K9B1V/Li/GR/Fh32JH3vuTfKHkGddsBU8= From: "eric41293 at comcast dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107545] New: __is_abstract intrinsic fails to compile on incomplete unions Date: Mon, 07 Nov 2022 02:41:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: eric41293 at comcast dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107545 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, s= o an incomplete union can safely be determined not to be abstract. Thus, is_abst= ract is required to work for incomplete unions. However, the __is_abstract intrinsic, and hence also std::is_abstract, generates a compiler error in t= his 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 =3D __is_abstract(U); $ g++ is_abstract.cpp is_abstract.cpp:2:25: error: invalid use of incomplete type =E2=80=98union = U=E2=80=99 2 | bool b =3D __is_abstract(U); | ^ is_abstract.cpp:1:7: note: forward declaration of =E2=80=98union U=E2=80=99 1 | union U; | ^=