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

            Bug ID: 96944
           Summary: call of overloaded is ambiguous
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tangyixuan at mail dot dlut.edu.cn
  Target Milestone: ---

The following code is rejected by g++. clang++ compiles it successfully.

$ cat s.cpp

template < int I > int F( char [I]);
template < int I > int F( char a = I );
int b = F<0>(0);

$ g++ -c s.cpp
s.cpp:3:15: error: call of overloaded ‘F<0>(int)’ is ambiguous
    3 | int b = F<0>(0);
      |               ^
s.cpp:1:24: note: candidate: ‘int F(char*) [with int I = 0]’
    1 | template < int I > int F( char [I]);
      |                        ^
s.cpp:2:24: note: candidate: ‘int F(char) [with int I = 0]’
    2 | template < int I > int F( char a = I );
      |

Reply via email to