This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/8427: internal error on ambiguous function template
- From: bangerth at dealii dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, rl at tempest-sw dot com
- Date: 4 Nov 2002 15:17:43 -0000
- Subject: Re: c++/8427: internal error on ambiguous function template
- Reply-to: bangerth at dealii dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, rl at tempest-sw dot com, gcc-gnats at gcc dot gnu dot org
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