This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
GNU C++ error
- To: egcs-bugs at cygnus dot com
- Subject: GNU C++ error
- From: "Jose B. Garcia Perez-Schofield" <jgarcia at ancares dot ei dot uvigo dot es>
- Date: Fri, 26 Feb 1999 14:34:47 +0200 (EET)
- cc: bug-g++ at prep dot ai dot mit dot edu
First of all, excuse me to send this email, but I'm following the
instructions that the compiler show me trying to compile the attached
programs.
Also, I want to clear that the motivation for compiling that programs was
to probe the new ANSI C++ features.
And also, finally, I am sending this message duplicated because the same
error was produced by g++ 2.8.1 (MIT) and egcs 2.9.20 (Cygnus).
The error was (the same for the two compilers):
pru_tem3:8:internal compiler error
pru_tem3:8:please send a complete bug report to egcs-bugs@cygnus.com
bug-g++@prep.ai.mit.edu
pru_tem2.cpp works fine. It's a simply function templated use.
pru_tem3.cpp contains the templated function and an especialization of it.
I hope that this could help you in some way.
Greetings,
jose
--------------------------------------------------------
Q: How many C++ programmers does it take to change a light bulb?
A: You're still thinking procedurally! A properly designed light bulb object
would inherit a change method from a generic light bulb class!
--------------------------------------------------------
PAC -- Jose Baltasar Garcia Perez-Schofield
Escuela Técnica de Informática de Gestión
Dep. Lenguajes y Sistemas Informaticos, Universidad de Vigo (Spain)
Tfno. 988-387029 Email. jgarcia@ei.uvigo.es jbgarcia@uvigo.es
#include <iostream>
template<class T, class U>
void conv(const T& x,U& y) { y = static_cast<U>(x); }
template<class T, class U>
void conv<const char*, int>(const char*& x,int y)
{ y = reinterpret_cast<int>(x); };
using namespace std;
int main(void)
{
int i = 65;
char c;
conv(i,c); // Conv i en c.
cout << c; // 'a'
cout << endl;
}
#include <iostream>
template<class T, class U>
void conv(const T& x,U& y) { y = static_cast<U>(x); }
using namespace std;
int main(void)
{
int i = 65;
char c;
conv(i,c); // Conv i en c.
cout << c; // 'a'
cout << endl;
}