Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed (Author was flagged for spam)

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

61
Since when does GCC support std::unordered_map with incomplete types?
Post Body

EDIT3: It's not std::unordered_map that's changed, it's std::pair. I suspect it's this commit that made this sort of incomplete container possible (yay concepts!), but would love for someone who speaks stdlib to confirm.

Original Post:

This compiles on GCC trunk:

#include <unordered_map>

struct Incomplete;

std::unordered_map<int, Incomplete> map;

struct Incomplete {};

int main() {};

Was this an intentional change or just a collateral bonus? It makes implementing certain types of recursive types convenient, and it's been true (though obviously not standards conforming) for std::map for awhile. Just wondering if there was some impetus for this change.

EDIT: To be clear, this is only supported on trunk. I'm not literally asking "since when?" I'm asking "How? And why now?"

EDIT2: This supported on clang trunk (and only clang trunk) as well, though that makes sense since it's probably a libstdc change not a compiler one.

Author
Account Strength
0%
Account Age
12 years
Verified Email
Yes
Verified Flair
No
Total Karma
54,512
Link Karma
2,985
Comment Karma
44,491
Profile updated: 3 months ago
Posts updated: 7 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
2 years ago