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; | ^