https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119486
Bug ID: 119486 Summary: CTAD for std::pair from function lvalue results in hard error since C++20 Product: gcc Version: 15.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: de34 at live dot cn Target Milestone: --- When using GCC w/ libstdc++, the following example is accepted in C++17 but rejected in C++20. Curiously, Clang w/ libstdc++ rejects even in C++17. https://godbolt.org/z/o5KPecMs5 ``` #include <type_traits> #include <utility> void fun() {} static_assert(std::is_same_v<decltype(std::pair(fun, fun)), std::pair<void(*)(), void(*)()>>); ``` It seems to me that the implicit deduction guide should be excluded by SFINAE before instantiation, while the decaying explicit deduction guide should work. MSVC STL seems to be correct here. Related libc++ issue: https://github.com/llvm/llvm-project/issues/133056