[cfe-dev] Recognizing aggregates

Eli Friedman eli.friedman at gmail.com
Sun Dec 18 15:01:50 PST 2011


On Sat, Dec 17, 2011 at 10:51 AM, Sebastian Redl
<sebastian.redl at getdesigned.at> wrote:
> Hi,
>
> I've got a problem. I've just finished a partial implementation of list-initialization of non-aggregates, and now several test cases fail. These test cases just test whether specific types are aggregates, but to do so, they attempt to use list-initialization on them. Now that list-initialization is possible for non-aggregates, these tests no longer work. Because these tests want to test the C++11 definition of aggregates, they have to run in C++11 mode.
>
> Is there an alternative to list-initialization for detecting aggregates? There is no type trait, and while I could easily implement one, doing so just for some tests seems like massive overkill.

I don't see why list-initialization is insufficient: if a type isn't
an aggregate, it will start looking for constructors, and you can
easily ensure no constructor matches.

-Eli




More information about the cfe-dev mailing list