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]

[herbert@gondor.apana.org.au: Bug#21122: g++: eg++ doesn't compile programs accepted by g++]


The following was reported as a bug through the Debian bugtracking system
(http://www.debian.org/). Please Cc: 21122@bugs.debian.org on on-topic
replies.

Background: Debian's "g++" package is egcs's g++ (1.0.2 + patch from
http://www.cygnus.com/ml/egcs/1998-Apr/0614.html).

The example code is accepted by gcc 2.7.2.3's g++.

Greetings,
Ray
-- 
Obsig: developing a new sig


Package: g++
Version: 2.90.27-0.5
Severity: important

This means that working packages are broken by egcs, hence the important
severity.

Here's the program in question (a scaled down version, comes from prcs):
(If this turns out to be against the ANSI standard, please tell me, thanks)

template<class T>
class A {
public:
	operator const T*() const;
	const T* cast() const;
};

template<class T>
A<T>::operator const T*() const {
	return 0;
}

template<class T>
const T* A<T>::cast() const {
	return operator const T*();
}

template class A<char>;


--
To UNSUBSCRIBE, email to debian-bugs-dist-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org




On Tue, Apr 14, 1998 at 10:28:46PM +1000, Herbert Xu wrote:
> Here's the program in question (a scaled down version, comes from prcs):
> (If this turns out to be against the ANSI standard, please tell me, thanks)
> 
> template<class T>
> class A {
> public:
> 	operator const T*() const;
> 	const T* cast() const;
> };
> 
> template<class T>
> A<T>::operator const T*() const {
> 	return 0;
> }
> 
> template<class T>
> const T* A<T>::cast() const {
> 	return operator const T*();
> }
> 
> template class A<char>;

Are you sure about that last line? If it's the intend to instantiate
template A with char, then it should be something like
	   class A<char> foo;
	^  ------------- ---
	|       ^         ^
	|       |         |
	|     type       variable
	|
	no template here
which compiles.

Ray
-- 
Obsig: developing a new sig


--
To UNSUBSCRIBE, email to debian-bugs-dist-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org




jdassen@wi.leidenuniv.nl wrote:
> >
> > template class A<char>;
> 
> Are you sure about that last line? If it's the intend to instantiate
> template A with char, then it should be something like

Yep, it's called explicit template instantiation.

PS Please pleasea cc me when you reply or otherwise I'd probably miss it as I
did here.  Thanks.

-- 
Debian GNU/Linux 1.3 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


--
To UNSUBSCRIBE, email to debian-bugs-dist-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



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