🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Russel Winder Tue, 07 Apr 1992 18:17
g++ bug report
#218
Author: Russel Winder
Date: Tue, 07 Apr 1992 18:17
110 lines
2909 bytes
Attached are two strip-down programs highlighting at least 2 bugs in g++
2.1.

The first indicates a problem with const member function in templates.
In my more complicated original I got internal compiler
error on signal 11 type problems.  In the stripped down I got the
message:

> g++ trial.cc
> trial.cc: In function `int  main ()':
> trial.cc:18: template for method `Y' doesn't match any in class `X<int>'
> 
> Compilation exited abnormally with code 1 at Tue Apr  7 16:58:36

The second problem, I have been unable to get beyond the error message:

> g++ trial_2.cc
> /cs/research/coside/users/croissant/russel/local/bin/gcc: Internal
compiler error: program cc1plus got fatal signal 11
> 
> Compilation exited abnormally with code 1 at Tue Apr  7 17:07:03

In the time available.  

I am told that GCC was configured by issuing:

./configure --target=space-sun-sunos4.1

Russel.

==========================================================================

Dr Russel Winder		(InterNet: R.Winder@cs.ucl.ac.uk)
Department of Computer Science	(UUCP: {...mcsun!ukc!}ucl-cs!R.Winder)
University College London	(JANet: R.Winder@uk.ac.ucl.cs)
Gower Street
London WC1E 6BT
England

Phone: +44 (0)71 380 7293
Fax: +44 (0)71 387 1397

=========================================================================

//  This program should give the error message since the types are
//  wrong, it compiles and runs.  Putting the const in the class
//  declaration to correct things causes the error.

#include <iostream.h>

template <class T>
class W
{
public:
    void Y() const // Inlining presents no problems at all.
    {
	cout << "Executing W<T>::Y\n" ;
    }
} ;

template <class T>
class X
{
public:
    void Y() ; // put const here and everything falls apart...
} ;

template <class T>
void X<T>::Y() const // ... because this const appears to be ignored!
{
    cout << "Executing X<T>::Y\n" ;
}

main()
{
    W<int> z0 ;
    z0.Y() ;
    X<int> z1 ;
    z1.Y() ;
}

=======================================================================

//  Some complexity in the template generation causes an internal compiler error.

#include <iostream.h>

template <class T>
class X
{
public:
    void Y() ;
} ;

template <class T>
void X<T>::Y()
{
    cout << "Executing X<T>::Y\n" ;
}

template <class T>
ostream& operator << (ostream& os, X<T> s)
{
    return os ;
}

main()
{
    X<int> z1 ; // compiles perfectly without this line!
}
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads