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 gdr at integrable-solutions dot net  2005-03-27 03:16 -------
Subject: Re:  Do not print default template arguments in error messages

"giovannibajo at libero dot it" <gcc-bugzilla@gcc.gnu.org> writes:

| (In reply to comment #31)
| 
| > >Patched: 
| > >test.cc: In member function 'void A<T, N, X>::foo() [with T = int]': 
| > >test.cc:14:   instantiated from here 
| > >test.cc:9: error: 'class std::vector<int>' has no member 
| named 'doesnotexist' 
| >  
| > That's a good improvement, but do you think you could write the first line 
| > with A<T> instead of A<T,N,X>? I find it confusing to see the second and 
| > third template argument, but then no explanation as to their values... 
| 
| That's exactly what I was hinting at at the end of comment #7. I then 
| implemented the solution proposed in comment #8 (showing them with <default>), 
| until Gaby said it would be a showstopper.

*If* you print N and X then yes it is surprising not to say what they
 bind to ("explanation"); but "<default>" is not good.
However, if you do not print them, then you don't have to explain what
 they mean.

| I will investigate printing A<T> instead of A<T,N,X>, but I am not confident it 
| can be done easily (if at all).

If you're going to print only the binding of "T", and not for N nor
X, then you do know that you don't have to print them, i.e. they are
instantiated with default values.
Granted, as the code in error.c currently is, you would have those
information only after the fact (in dump_bindings()).  However, the
code path in cxx-pretty-print.c is different and more amenable to that
kind of thing.  Alternatively, you could do lazy printing with error.c
but that is more complicated than it should be.

-- Gaby


-- 


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]