[PATCH] D31513: [Sema] Add __is_aggregate type-trait and implement LWG 2015

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 3 17:20:59 PDT 2017


EricWF added a subscriber: STL_MSFT.
EricWF added inline comments.


================
Comment at: docs/LanguageExtensions.rst:996
 * ``__is_abstract`` (GNU, Microsoft)
+* ``__is_aggregate`` (GNU, Microsoft)
 * ``__is_base_of`` (GNU, Microsoft)
----------------
aaron.ballman wrote:
> Has Microsoft already implemented this? If not, do we want to wait for them before claiming they implement it as well?
I asked @STL_MSFT to ping the frontend team to confirm they were planning on implementing it with this name. I was concerned this doc would never get updated otherwise. 


================
Comment at: lib/Sema/SemaExprCXX.cpp:4234
+    // support aggregate initialization. GCC mirrors this behavior for vectors
+    // but not _Complex.
+    return T->isAggregateType() || T->isVectorType() || T->isExtVectorType() ||
----------------
aaron.ballman wrote:
> Is there benefit to diverging from GCC's behavior here for _Complex types?
`_Complex` types act as if they are an array of 2 elements, and hence support aggregate initialization.

Ironically the GCC maintainer who implemented `is_aggregate` pointed this case out to me. I've pinged him to ask why he chose not to support it, or if the change is in the works.


https://reviews.llvm.org/D31513





More information about the cfe-commits mailing list