Re: template class with default parameter in template parameter declaration

2011-11-09 Thread Marc Glisse
On Tue, 8 Nov 2011, Marc Glisse wrote: On Tue, 8 Nov 2011, Ulrich Drepper wrote: Complicated title, here's a bit of code: #ifdef FIX # define PARM2 , class T5 #else # define PARMS2 #endif template struct cl1 { }; template class T4 = cl1> struct cl2 { }; cl2<> var; If co

Re: template class with default parameter in template parameter declaration

2011-11-08 Thread Andrew Pinski
On Tue, Nov 8, 2011 at 10:53 AM, Marc Glisse wrote: > On Tue, 8 Nov 2011, Ulrich Drepper wrote: > >> Complicated title, here's a bit of code: >> >> #ifdef FIX >> # define PARM2 , class T5 >> #else >> # define PARMS2 >> #endif >> >>

Re: template class with default parameter in template parameter declaration

2011-11-08 Thread Marc Glisse
On Tue, 8 Nov 2011, Ulrich Drepper wrote: Complicated title, here's a bit of code: #ifdef FIX # define PARM2 , class T5 #else # define PARMS2 #endif template struct cl1 { }; template class T4 = cl1> struct cl2 { }; cl2<> var; If compiled without FIX defined this will fail wi

template class with default parameter in template parameter declaration

2011-11-08 Thread Ulrich Drepper
Complicated title, here's a bit of code: #ifdef FIX # define PARM2 , class T5 #else # define PARMS2 #endif template struct cl1 { }; template class T4 = cl1> struct cl2 { }; cl2<> var; If compiled without FIX defined this will fail with gcc 4.3 and later. Haven't check

Re: template class

2011-06-10 Thread Ruben Safir
quot;<< ix<< " ] ia: "<< ia[ix] > > > << "\tca: "<< ca[ix] > > > << "\tda: "<< da[ix]<< std::endl; > > > > > > return 0; > > > } > > > --- >

Re: template class

2011-06-10 Thread Ian Lance Taylor
eric writes: > Thanks your suggestion, I follow it but it show fatal error:Array.cpp: > no such file > so > I add #include "Array.cpp" in my main program, pg52.cpp > then > it can compile > but > when I run it, it response > Segmentation fault > > again it's g++ 4.5.2. What may cause wrong? >

Re: template class

2011-06-10 Thread eric
<< "\tda: "<< da[ix]<< std::endl; > > > > return 0; > > } > > ------- > > // Array.cpp > > > > #include "Array.h" > > > > /* > > Array::Array(elemType *iarray, int iarray_size) > > { > >

Re: A forward declaration used by template class issue on gcc 4.4.1

2009-10-23 Thread Ian Lance Taylor
"Zhang Lin" writes: > class ACE_Message_Queue_NT; > template > ACE_Message_Queue_NT *ACE_Message_Queue_Factory::create_NT_message_queue > (int max_threads) > { > ACE_Message_Queue_NT *tmp = 0; > > tmp = new ACE_Message_Queue_NT (max_threads); > > return tmp; > } > > class ACE_Message_Queue_

A forward declaration used by template class issue on gcc 4.4.1

2009-10-23 Thread Zhang Lin
Hello, I have encountered an issue when building ACE with MinGW and GCC 4.4.1. The following example can reproduce the issue: == main.cpp == class ACE_Message_Queue_NT; template class ACE_Message_Queue_Factory { public: static ACE_Message_Queue_NT *create_NT_message_queue (int

Re: Possible 4.4.0 regression (can't match template ctor of template class where...)

2009-03-04 Thread Sebastian Redl
Simon Hill wrote: > g++ doesn't seem able to match a template ctor of a template class > where the ctor input is an internal class defined inside any template > class. > > I briefly skimmed the titles of the current regression issues and I > didn't notice any that m

Re: Possible 4.4.0 regression (can't match template ctor of template class where...)

2009-03-04 Thread Richard Guenther
On Wed, Mar 4, 2009 at 9:12 PM, Simon Hill wrote: > g++ doesn't seem able to match a template ctor of a template class > where the ctor input is an internal class defined inside any template > class. > > I briefly skimmed the titles of the current regression issues and I >

Possible 4.4.0 regression (can't match template ctor of template class where...)

2009-03-04 Thread Simon Hill
g++ doesn't seem able to match a template ctor of a template class where the ctor input is an internal class defined inside any template class. I briefly skimmed the titles of the current regression issues and I didn't notice any that matched this, but I'm not 100% sure. I first p

Re: c++0x {g++}4.4, =default definition outside template class fails{ to link}.

2008-08-26 Thread Paolo Carlini
Simon Hill wrote: Sorry Paolo, that definitely should have been. no problem. Is this a bug? I think so. I opened c++/37234, you may want to add yourself to the CC list of the PR. Paolo.

Re: c++0x {g++}4.4, =default definition outside template class fails{ to link}.

2008-08-25 Thread Simon Hill
Sorry Paolo, that definitely should have been. === THIS CODE FAILS TO LINK === template class foo { public: foo() =default; // <<--- this works fine. ~foo(); }; template foo::~foo() =default; <<--- ERROR: This doesn't get built by the compiler. // foo::~foo() {}; &l

Re: c++0x 4.4, =default definition outside template class fails.

2008-08-24 Thread Paolo Carlini
Hi, === THIS CODE FAILS TO COMPILE === template class foo { public: foo() =default; // <<--- this works fine. ~foo(); }; template foo::~foo() =default; <<--- ERROR: This doesn't get built by the compiler. // foo::~foo() {}; <<-- replacing with this line fix

Re: c++0x 4.4, =default definition outside template class fails.

2008-08-24 Thread Paolo Carlini
.. and I would suggest filing a normal Bugzilla PR, to the attention of [EMAIL PROTECTED] in CC, because it seems indeed a bug to me: we even have in the testsuite a very similar run-type test different only because the class isn't a template. Paolo.

Re: c++0x 4.4, =default definition outside template class fails.

2008-08-24 Thread Paolo Carlini
.. never mind, the problem you are seeing is at *link* time, ok... Paolo.

c++0x 4.4, =default definition outside template class fails.

2008-08-23 Thread Simon Hill
;m not 100% sure it is a bug. === THIS CODE FAILS TO COMPILE === template class foo { public: foo() =default; // <<--- this works fine. ~foo(); }; template foo::~foo() =default; <<--- ERROR: This doesn't get built by the compiler. // foo::~foo() {}; <<--

Why g++ does not emit any information for a local variable in a template class member function?

2008-06-03 Thread Peng Yu
; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Thanks, Peng template class A { public: A(int a) { T temp = a + 1; _a = temp + 1; } private: T _a; }; int main() { A a(1); } $ gdb main GNU gdb 6.4.90-debian Copyright (C) 2006 Free Software Foundation

Re: template class scoping rules

2006-03-14 Thread David Fang
constructor 'Three::Three()': > test.cpp:20: error: 'm_Public' was not declared in this scope > > class One > { > public: > One(); > ~One(); > > public: > int m_Public; > }; > > template class Two : public One > { > pub

template class scoping rules

2006-03-14 Thread Matthew J Fletcher
public: int m_Public; }; template class Two : public One { public: Two() {m_Public = 0;} }; template class Three : public Two { public: Three() {m_Public = 0;} }; this fixes it. template class Three : public Two { public: Three() {Two::m_Public = 0;} };

Re: specific instantiation of static members from template class

2005-11-17 Thread Jonathan Wakely
main(int argc, char **argv) > { > std::cout << TestInt::member << std::endl; > return 0; > } > > / test.h > template > class Test > { > public: > > static T member; > }; add this line here: template T Test::member; >

specific instantiation of static members from template class

2005-11-17 Thread cedric
ber << std::endl; return 0; } / test.h template class Test { public: static T member; }; typedef Test TestInt; / test.cpp #include "Test.h" template class Test; template<> int Test::member; I got an error at link because it cannot find the symb