[Bug c++/15254] friend function does not have access to private method in templeted classes
hyliviu-gcc at yahoo dot com
gcc-bugzilla@gcc.gnu.org
Mon May 3 04:30:00 GMT 2004
------- Additional Comments From hyliviu-gcc at yahoo dot com 2004-05-03 04:30 -------
Yes, I have read the changes page and the links that you provided. I'm afraid
this is a different issue.
I believe you are referring me to this part of the changes page:
"In case of friend declarations, every name used in the friend declaration
must be accessible at the point of that declaration. Previous versions of G++
used to be less strict about this and allowed friend declarations for private
class members, for example. See the ISO C++ Standard Committee's defect report
#209 for details."
And also (http://gcc.gnu.org/bugs.html#cxx_rvalbind):
"Starting with GCC 3.4.0, binding an rvalue to a const reference requires an
accessible copy constructor. This might be surprising at first sight,
especially since most popular compilers do not correctly implement this rule.
The C++ Standard says that a temporary object should be created in this
context and its contents filled with a copy of the object we are trying to
bind to the reference; it also says that the temporary copy can be elided, but
the semantic constraints (eg. accessibility) of the copy constructor still
have to be checked."
I don't want to reopen the bug, but I think this is a chicken & egg problem.
I'm declaring convert as a friend "exactly" because I want access to those
private copy-constructors.
I would be really glad if someone could provide me with a solution to this,
short of declaring the copy-constructor public.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15254
More information about the Gcc-bugs
mailing list