c++/99: Bug in type in error message.

Wolfgang Bangerth bangerth@ticam.utexas.edu
Sun Nov 10 11:26:00 GMT 2002


The following reply was made to PR c++/99; it has been noted by GNATS.

From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/99: Bug in type in error message.
Date: Sun, 10 Nov 2002 13:24:13 -0600 (CST)

 A slightly simpler to read example is this:
 ------------------------------------
 template<int p> class X { };
 
 template<int n, int m> int f(X<n>, X<m>) {
   return f(X<n-1>(), X<m-1>()) + f(X<n-1>(), X<m>());
 }
 
 template<int n> int f(X<n>, X<0>);
 template<int m> int f(X<0>, X<m>);
 
 int main(void) {
    return f(X<2>(), X<1>());
 }
 --------------------------------------
 
 The messages I get are these:
 x.cc: In function `int f(X<n>, X<m>) [with int n = 1, int m = 1]':
 x.cc:4:   instantiated from `int f(X<n>, X<m>) [with int n = 2, int m = 1]'
 x.cc:11:   instantiated from here
 x.cc:4: error: call of overloaded `f(X<0>, X<0>)' is ambiguous
 x.cc:3: error: candidates are: int f(X<n>, X<m>) [with int n = 0, int m = 0]
 x.cc:7: error:                 int f(X<n>, X<0>) [with int n = 0]
 x.cc:8: error:                 int f(X<0>, X<n>) [with int m = 0]
 
 Note the last line with "n" vs. "m".
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
                                www: http://www.ticam.utexas.edu/~bangerth
 
 



More information about the Gcc-prs mailing list