https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69717
Bug ID: 69717 Summary: std::pair is incompatible with std::is_constructible Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: david at doublewise dot net Target Milestone: --- #include <type_traits> #include <utility> struct S { S(int) {} }; int main() { using pair_t = std::pair<S, S>; static_assert(std::is_default_constructible<pair_t>::value, ""); pair_t p; } The static_assert does not fire, even though it should. If I comment out line 11, everything compiles. With line 11 in, I get a compile error that essentially tells me that pair_t is not default constructible. This is with -std=c++1z, which has pair's constructors only participating in overload resolution if they are valid. Compiling with clang and libstdc++ gives different behavior. The static_assert fails to compile, but not with a regular static_assert message. It gives a hard error, similar to what gcc gives when you actually try to compile line 11. However, it is a hard error not in the immediate context, so attempting to use it for SFINAE with enable_if causes a compile time error. In other words, I get a compiler error with clang if I just mention std::is_default_constructible<pair_t>, which seems like 'correct' behavior based on the implementation of std::pair (but not correct in c++1z mode). So this actually seems like a bug in both gcc and libstdc++. libstdc++ has a std::pair implementation that causes a hard error even in c++1z mode if you check if it is default constructible and it is not, and gcc has a bug that causes it to ignore that error and just return true for std::is_default_constructible. This looks related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68430