[Bug c++/17763] Wrong context in error message for template parameter

gdr at cs dot tamu dot edu gcc-bugzilla@gcc.gnu.org
Fri Oct 1 13:33:00 GMT 2004


------- Additional Comments From gdr at cs dot tamu dot edu  2004-10-01 13:33 -------
Subject: Re:  Wrong context in error message for template parameter

"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| Confirmed. Take this smaller testcase: 
| ---------------------- 
| template <typename U> struct Outer { 
|     struct Inner {}; 
|     Inner foo(); 
| }; 
|  
| typedef int X; 
| typedef Outer<X> XOuter; 
|  
| int main() { 
|   Outer<int>  ab; 
|   ab.foo() == 1; 
| } 
| ------------------------ 
| Clearly, we make no use of the typedefs 'X' and 'XOuter', but we get this 
| error message: 
|  
| g/x> /home/bangerth/bin/gcc-4.0-pre/bin/c++ -c x.cc 
| x.cc: In function `int main()': 
| x.cc:11: error: no match for 'operator==' in 'ab. Outer<U>::foo [with U = X]() 
| == 1' 
|  
| The part of the error message in brackets should really read '[with U=int]', 
| rather than mention 'X'. Note that if I remove the 'XOuter' typedef, then 
| I do indeed get what I want. 

Thank you, Wolfgang!  The diagnostic is also broken in that it is
printing something nonsensical

   'ab. Outer<U>::foo [with U = X]() == 1'

That isn't C++. 

Please could you assign this to me as enhancement?  
I do not have plan to fix it in time for 4.0.0, though.

-- Gaby


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17763



More information about the Gcc-bugs mailing list