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

            Bug ID: 86191
           Summary: A missing error message?
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhonghao at pku dot org.cn
  Target Milestone: ---

The code is as follow:

template<int i> struct g {};

template<int i, int j> void f(g<i/j>) { }
template<int i, int j> void f(g<j>) { } 

int main()
{
  f<4,2>(g<4/2>());
}

When clang++ compiles the code, it produces the following messages:
1gcc01.cpp:8:3: error: call to 'f' is ambiguous
1gcc01.cpp:3:29: note: candidate function [with i = 4, j = 2]
1gcc01.cpp:4:29: note: candidate function [with i = 4, j = 2]
    template<int i, int j> void f(g<j>) { } 

However, when g++ compiles the code, it does not produce any error messages. Is
the code legal or not? For me, it seems that the messages of clang++ are
reasonable.

Reply via email to