LWG 2911 adds std::is_aggregate to the library, which requires a new builtin trait. This patch implements __is_aggregate.
Details
Diff Detail
Event Timeline
- Update the doc to reflect that GCC has implemented this trait (and to assume MS will as well).
- Rewrite the tests using static_assert over god-awful old style array asserts.
- Correctly report array types as aggregates. (Woops!)
- Also report vector types as aggregates. This behavior mirrors GCC.
- report _Complex int and _Complex float as aggregates as well. Currently GCC does not have this behavior, but since they support aggregate initialization I think it makes sense to support them as aggregates.
docs/LanguageExtensions.rst | ||
---|---|---|
996 | 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. | |
lib/Sema/SemaExprCXX.cpp | ||
4234 | _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. |
docs/LanguageExtensions.rst | ||
---|---|---|
996 | Seems reasonable. My concern is that we claim Microsoft implements this when they don't (yet) and someone uses this documentation to try to force Microsoft's hand. However, it seems that this documentation not being updated is the far more likely scenario. ;-) | |
lib/Sema/SemaExprCXX.cpp | ||
4089 | If I understand properly, this change is required by LWG 2015 for existing type traits *and* is needed for is_aggregate()? If so, it probably should be a separate patch doing just LWG 2015 (and tests) and a second one for is_aggregate(). | |
4234 | Thanks! I think supporting it makes sense. |
docs/LanguageExtensions.rst | ||
---|---|---|
996 | MS intends to implement this hook under this name. No ETA yet. |
lib/Sema/SemaExprCXX.cpp | ||
---|---|---|
4089 | Ack. |
docs/LanguageExtensions.rst | ||
---|---|---|
996 | Lovely, then I'm happy with the documentation as-is. |
Has Microsoft already implemented this? If not, do we want to wait for them before claiming they implement it as well?