https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87429

            Bug ID: 87429
           Summary: Strange overload resolution with decltype in template
                    function
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zamazan4ik at tut dot by
  Target Milestone: ---

gcc(trunk) for this code:

#include <iostream>

template <typename T> int foo(int) { return 1; }
template <typename T> int foo(decltype(T{})) { return 2; }
template <typename T> int foo(decltype(int(T{}))) { return 3;}

int main()
{
    std::cout << foo<int>(0);
}

prints '2'. But as I understand here should be compilation error because of
ambiguous call to overload function

Reply via email to