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

            Bug ID: 116876
           Summary: GCC accepts invalid call to overloaded function
                    template
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jlame646 at gmail dot com
  Target Milestone: ---

The following invalid program is accepted by gcc and msvc but rejected by
clang. 

```
#include <utility>
#include <iostream>
template< class T > void f( T& t ){} ;
template< class T > void f( const T&& ) {};
int main()
{
    int i = 0;
    f<int&>(i); //clang:nope, gcc:ok, msvc:ok
} 
```
Demo: https://godbolt.org/z/4K7ErvWjh

Related thread:
https://stackoverflow.com/questions/79034394/function-template-overloading-when-called-with-reference-type-rejected-by-clang

Reply via email to