c++/199: Re: Namespace-/Template-/Friend-Bug

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Wed May 10 11:06:00 GMT 2000


>Number:         199
>Category:       c++
>Synopsis:       Namespace-/Template-/Friend-Bug
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          analyzed
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Wed May 10 11:06:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     "Thomas Luzat" <thomas.luzat@gmx.net>
>Release:        2.96
>Organization:
>Environment:
>Description:
 Original-Message-ID: <004001bfba8d$82396da0$9c1ae195@deepthought>
 Reply-To: "Thomas Luzat" <thomas@luzat.de>
 Date: Wed, 10 May 2000 16:30:02 +0200

 here's some code that doesn't work for me. It works as long as I don't put
 it in a namespace. Others have confirmed it should work. The files included
 in the tar/bzip2 file are:

 test1.cpp: The original program  which let's the compiler hang under Win2k.
 test1.txt: Console output for 'gcc -v --save-temps test1.cpp'
 test1.ii: Preprocessed output

 [works in 2.96 20000430 - omitted here - MvL]

 test2.*: A variation I tried which gives other errors (see test2.txt)

 I had to copy-and-paste the txt-files as pipes didn't work.

 gcc -v output:

 Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/specs
 gcc version 2.95.2 19991024 (release)

 OS:

 Windows 2000 Professional.

 Hopefully this error (if it is one) will be fixed soon... :-)
 Contact me if you need any further info. Thanks for your time!


 Thomas Luzat

>How-To-Repeat:
namespace X
{
	template <class T>
	class C
	{
	private:
		T t;
	public:
		C(const T &other) : t(other) { }
		C(const C<T> &other) : t(other.t) { }

		template <class T2> friend class X::C; // <- added X::
		template <class T2> C(const C<T2> &other) : t(other.t) { }
	};
}


int main()
{
	X::C<float> x(0);
	X::C<int> y(x);
	
	return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the Gcc-prs mailing list