This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/32308] New: template <typename T> int CTemp< int >::sta; make the error
- From: "cxcxcxcx at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Jun 2007 16:05:16 -0000
- Subject: [Bug c++/32308] New: template <typename T> int CTemp< int >::sta; make the error
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
gcc -v :
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-mpfr --with-tune=i686
--enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
g++ -o a a.cpp
a.cpp: In function ¡®void func(T) [with T = int]¡¯:
a.cpp:19: instantiated from ¡®int CTemp<int>::sta¡¯
a.cpp:19: instantiated from ¡®void func(T) [with T = int]¡¯
a.cpp:24: instantiated from here
a.cpp:19: internal compiler error: in instantiate_decl, at cp/pt.c:11775
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>.
Preprocessed source stored into /tmp/ccXG3CFA.out file, please attach this to
your bugreport.
Source File:
#include<iostream>
using namespace std;
template < class T >
class CTemp{
private:
T element;
public:
CTemp (T arg):element(arg){ }
static int sta;
};
template <typename T> int CTemp< int >::sta;
template < class T >
void func (T arg){
CTemp < T > a (arg);
int i;
cout << a.sta <<endl;
return;
}
int main(){
func (5);
return 0;
}
I'm sorry but I find anywhere to add an attachment
--
Summary: template <typename T> int CTemp< int >::sta; make the
error
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: cxcxcxcx at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32308