Код: Выделить всё
#include
#include
template< class T > void f( T& t ){} ;
template< class T > void f( const T&& ) {};
int main()
{
int i = 0;
f(i); //clang:nope, gcc:ok, msvc:ok
}
Код: Выделить всё
:10:5: error: call to 'f' is ambiguous
10 | f(i); //clang:nope, gcc:ok, msvc:ok
| ^~~~~~~
:4:26: note: candidate function [with T = int &]
4 | template< class T > void f( T& t ){} ;
| ^
:5:26: note: candidate function [with T = int &]
5 | template< class T > void f( const T&& ) {};
|
Подробнее здесь: https://stackoverflow.com/questions/790 ... d-by-clang