🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1299

GNU C++ template bug

#1299
From: Simon Greener
Date: Fri, 18 Dec 1992 15:28
38 lines
1285 bytes
#include <iostream.h>

template <class T>
class vector {
private:
    T a[3];
public:
    vector( T a1, T b2, T c3 )
    { 
        a[0] = a1;
        a[1] = b2;
        a[2] = c3;
    };

    T dot( const vector<T> other )
    {
        return (a[0] * other.a[0]) + (a[1] * other.a[1]) + (a[2] * other.a[2]);
    }
};


int main( int argc, char *argv[] )
{
    vector<int> v1(1,1,1);
    vector<int> v2(2,3,4);

    cout << "Dot Product = " << v1.dot(v2) << endl;

    return 0;
}

// The above gives up with "parse error before `>'" at line 16.  In general
// the GNU compiler does not seem to like template member functions referencing
// the type of the the template class.  I'm using GNUC version 2.2.2. on a PC
// running MS-DOS version 3.30.  The GNUCC is unmodified - as obtained from
// D.J. Delorie.
//
// My address is 100065.72@compuserv.com
Technical Details
Message-ID: <921218152830_100065.72_EHF32-1@CompuServe.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!compuserve.COM!100065.72

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!compuserve.COM!100065.72
From: 100065.72@compuserve.COM (Simon Greener)
Subject: GNU C++ template bug
Message-ID: <921218152830_100065.72_EHF32-1@CompuServe.COM>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 18 Dec 1992 15:28:30 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 40