From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8564 invoked by alias); 29 Apr 2003 16:26:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 8520 invoked by uid 71); 29 Apr 2003 16:26:00 -0000 Resent-Date: 29 Apr 2003 16:26:00 -0000 Resent-Message-ID: <20030429162600.8519.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, gianni@mariani.ws Received: (qmail 5676 invoked by uid 48); 29 Apr 2003 16:16:50 -0000 Message-Id: <20030429161650.5675.qmail@sources.redhat.com> Date: Tue, 29 Apr 2003 16:26:00 -0000 From: gianni@mariani.ws Reply-To: gianni@mariani.ws To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/10541: template does not work X-SW-Source: 2003-04/txt/msg01349.txt.bz2 List-Id: >Number: 10541 >Category: c++ >Synopsis: template does not work >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Tue Apr 29 16:26:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: gianni@mariani.ws >Release: GCC 3.2.2 >Organization: >Environment: Linux RH 8.0 configure --enable-shared --enable-threads=posix --disable-checking --host=i386-redhat-linux --with-system-zlib --enable-__cxa_atexit Thread model: posix gcc version 3.2.2 >Description: g++ gives a number of errors to the code below. As far as I can tell it's legal C++. g++ tt6.cpp -o tt6 tt6.cpp:43: could not convert template argument `0' to `char*' tt6.cpp:43: ISO C++ forbids declaration of `m_cstr' with no type tt6.cpp:45: `0' is not a valid template argument tt6.cpp:45: it must be the address of an object with external linkage tt6.cpp:45: ISO C++ forbids declaration of `m_cstr_c' with no type tt6.cpp:47: `tester::m_static' is not a valid template argument tt6.cpp:47: it must be the address of an object with external linkage tt6.cpp:47: ISO C++ forbids declaration of `m_cstr_s' with no type make: *** [tt6] Error 1 #include template < char * w_val > class IType { public: char * m_value; inline IType() : m_value( w_val ) { } inline operator char * & () { return m_value; } inline operator const char * & () const { return m_value; } inline char * & operator = ( const char * & i_value ) { m_value = i_value; return m_value; } }; class tester { public: const static char * m_static; IType<0> m_cstr; IType( 0 )> m_cstr_c; IType m_cstr_s; }; >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: