c++/8427: internal error on ambiguous function template

bangerth@dealii.org bangerth@dealii.org
Mon Nov 4 07:17:00 GMT 2002


Synopsis: internal error on ambiguous function template

State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Mon Nov  4 07:17:42 2002
State-Changed-Why:
    gcc 3.3 now says
    -----------------------------
    home/bangerth> /home/bangerth/bin/gcc-3.3-pre/bin/c++ -c gcc01.cpp -o /dev/null
    gcc01.cpp: In function `int main()':
    gcc01.cpp:8: error: call of overloaded `f(g<2>)' is ambiguous
    gcc01.cpp:3: error: candidates are: void f(g<(i / j)>) [with int i = 4, int j = 2]
    gcc01.cpp:4: error:                 void f(g<j>) [with int i = 4, int j = 2]
    
    The message seems correct to me. I think you're just out
    of luck here, since the language does not provide you with
    a way to disambiguate which function you wanted to call.
    
    Regards
      W.
    
    
    Original code:
    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>());
    }
    

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8427



More information about the Gcc-bugs mailing list