This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/14912] Do not print default template arguments in error messages


------- Additional Comments From giovannibajo at libero dot it  2005-03-26 19:24 -------
OK, before I clean up the patch, I'll post an example. For this code:

----------------------------------------------
#include <map>
#include <vector>
#include <string>

std::map<std::string, std::vector<int> > m;

void bar(void)
{
  std::vector<int> k;
  m.insert(std::make_pair(0, k));
}
----------------------------------------------

I get this:

<path>/stl_pair.h: In constructor 'std::pair<_T1, _T2>::pair(const 
std::pair<_U1, _U2>&) [with _U1 = int, _U2 = std::vector<int>, _T1 = const 
std::string, _T2 = std::vector<int>]':
test3.cc:10:   instantiated from here
<path>/stl_pair.h:90: error: invalid conversion from 'const int' to 'const 
char*'
<path>/stl_pair.h:90: error:   initializing argument 1 
of 'std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, 
const _Alloc&) [with _CharT = char]'

(I manually edited '<path>')
Without my patch, I get this:


<path>/stl_pair.h: In constructor `std::pair<_T1, _T2>::pair(const 
std::pair<_U1, _U2>&) [with _U1 = int, _U2 = std::vector<int, 
std::allocator<int> >, _T1 = const std::string, _T2 = std::vector<int, 
std::allocator<int> >]':
test3.cc:10:   instantiated from here
<path>/stl_pair.h:90: error: invalid conversion from `const int' to `const 
char*'
<path>/stl_pair.h:90: error:   initializing argument 1 of 
`std::basic_string<_CharT, _Traits, _Alloc>::basic_string(const _CharT*, const 
_Alloc&) [with _CharT = char, _Traits = std::char_traits<char>, _Alloc = 
std::allocator<char>]'


If someone wants to submit an additional testcase, I'm happy to test it.

-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]