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]

template friend class


g++ v.: 2.95.2
system: Ultra Enterprise 450 running Solaris 8
options/flags: -pedantic -W -Wall -Wcast-qual \
        -Wconversion -Winline -Wmissing-declarations -Wmissing-prototypes \
        -Wnested-externs -Wno-import -Wpointer-arith -Wshadow \
        -Wstrict-prototypes -Wtraditional -Wwrite-strings \
        -fguiding-decls \
        -ftemplate-depth-40 \
        -O3 \
        -Wno-non-template-friend
error: c++ -c useezptr.cpp -pedantic -W -Wall -Wcast-qual -Wconversion
-Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs
-Wno-import -Wpointer-arith -Wshadow -Wstrict-prototypes -Wtraditional
-Wwrite-strings -fguiding-decls -ftemplate-depth-40 -O3
-Wno-non-template-friend
In file included from
/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/../../../../include/g++-3/string:6,
                 from ezexcept.hpp:11,
                 from ezptrex.hpp:11,
                 from ezptr.hpp:64,
                 from useezptr.cpp:1:
/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/../../../../include/g++-3/std/bastring.h: In
method `basic_string<charT,traits,Allocator>::basic_string(InputIterator,
InputIterator)':
/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/../../../../include/g++-3/std/bastring.h:187: warning: declaration
of `end' shadows a member of `this'
/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/../../../../include/g++-3/std/bastring.h:187: warning: declaration
of `begin' shadows a member of `this'
In file included from
/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/../../../../include/g++-3/std/bastring.h:652,
                 from
/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/../../../../include/g++-3/string:6,
                 from ezexcept.hpp:11,
                 from ezptrex.hpp:11,
                 from ezptr.hpp:64,
                 from useezptr.cpp:1:
/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/../../../../include/g++-3/std/bastring.cc: In
method `void basic_string<charT,traits,Allocator>::alloc(unsigned int,
bool)':
/usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/../../../../include/g++-3/std/bastring.cc:98: warning: declaration
of `size' shadows a member of `this'
In file included from useezptr.cpp:1:
ezptr.hpp: At top level:
ezptr.hpp:129: Internal compiler error.
ezptr.hpp:129: Please submit a full bug report.
ezptr.hpp:129: See
<URL:http://www.gnu.org/software/gcc/faq.html#bugreport> for instructions.
make: *** [useezptr.o] Error 1

intention: I was trying to allow my casting operator

template<typename itemType>
template<typename itemType2>
extern
ezptr<itemType>::
operator ezptr<itemType2>( void ) const
{
	ezptr<itemType2> return_value;
        ezptr<itemType> temp( *this );

	::swap( dynamic_cast<itemType2*>( temp.rep_ ), 
		return_value.rep_ );
        ::swap( temp.num_refs_, return_value.num_refs_ );
// ...other members
	return return_value;
}

to have access to the 'private' data members for deep-copying.  I've
accomplished this before about a year ago using gcc on the same system on
another project that used class templates.  Any help is appreciated.  I
apologize if the solution is trivial, I tried to find the answer using
newsgroups first.  Please, do not post any of this code _anywhere_.

Mark M. Young
youngmm@hera.wku.edu

"C++ is to programming as sex is to reproduction. Better ways might
technically exist but they're not nearly as much fun." -- Nikolai Irgens

useezptr.ii.gz


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