This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13995] Friend declaration with template-id causes confusion of function arguments
- From: "gdr at integrable-solutions dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Feb 2004 11:04:56 -0000
- Subject: [Bug c++/13995] Friend declaration with template-id causes confusion of function arguments
- References: <20040203104459.13995.heinlein@informatik.uni-ulm.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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