[Bug c++/87429] New: Strange overload resolution with decltype in template function
zamazan4ik at tut dot by
gcc-bugzilla@gcc.gnu.org
Tue Sep 25 08:49:00 GMT 2018
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
More information about the Gcc-bugs
mailing list