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-25 22:06 -------
Subject: Re:  Do not print default template arguments in error messages

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

| ------- Additional Comments From giovannibajo at libero dot it  2005-03-23 02:44 -------
| I'll try to do this. This is a simple testcase:
| 
| ---------------------------
| template <class T, int N=0, int X=1>
| struct A
| {
|    typedef typename T::x x;
| };
| void foo(void)
| {
|   A<void,0> a;
| }
| ---------------------------
| test.cc: At global scope:
| test.cc: In instantiation of 'A<void, 0, 1>':
| test.cc:8:   instantiated from here
| test.cc:4: error: 'void' is not a class, struct, or union type
| 
| Do we want the error message to show 'A<void, 0>' or 'A<void>'? In other words, 

Most of the time, we want to print what user wrote.  In some cases, we
want to have the pretty-printer show all arguments.  I certainly don't
want unconditional omission of default argument.  You will probably
have to work on the '#' modifier -- ideally, a patch tp that effect
should confive cxx-pretty-printer.c and nor error.c.

| should GCC try and remember which arguments were really specified in the 
| template-id (hard to do), or a simple check of equalness between the argument 
| and the default parameter would suffice?


Not necessarily, we don't have unified types system in the C++
front-end.  But, you can use same_type_p().

-- 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]