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++/13995] Friend declaration with template-id causes confusion of function arguments


------- Additional Comments From gdr at integrable-solutions dot net  2004-02-03 11:04 -------
Subject: Re:  New: Friend declaration with template-id causes confusion of function arguments

"heinlein at informatik dot uni-ulm dot de" <gcc-bugzilla@gcc.gnu.org> writes:

| The following program prints 2 instead of 1, as it should.
| It seems that the friend declaration in struct X
| causes confusion of the function arguments.
| 
| Removing the argument name x in the friend declaration,
| produces the error message:
|   bug.cxx: In function `int f(int, T) [with T = int]':
|   bug.cxx:8:   instantiated from here
|   bug.cxx:5: `x' undeclared (first use this function)
| 
| When the friend declaration is removed, everything is fine.
| If struct X is moved before main(), it is fine, too.
| Likewise, if the template-id f<int> is replaced with a simple f.

This is a weird bug.  

-- Gaby


-- 


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


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