https://llvm.org/bugs/show_bug.cgi?id=21917

Louis Dionne <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |[email protected]
         Resolution|WORKSFORME                  |---

--- Comment #2 from Louis Dionne <[email protected]> ---
The following code triggers a hard error:

-----------------------------------------------------
#include <utility>


struct NoDefault { NoDefault() = delete; };

template <typename T, typename = decltype(std::pair<T, T>{})>
void f(int) { }

template <typename T>
void f(long) { }

int main() {
    f<NoDefault>(1);
}
-----------------------------------------------------

Instead, one would expect that the first `f` SFINAEs out because
`std::pair<NoDefault, NoDefault>` is not default constructible.
Instead, `std::pair` always provide a default-constructor, but it
is ill-formed when `T` is not default constructible.

This causes code like 

    std::is_default_constructible<std::pair<NoDefault, NoDefault>>::value

to trigger a hard error instead of returning `false`.

Live example: http://melpon.org/wandbox/permlink/A0d3lFEeEXEs0BzT

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to