| Thread overview | ||||||||
|---|---|---|---|---|---|---|---|---|
| 
 | 
| June 28, 2004compiler bug? | ||||
|---|---|---|---|---|
| 
 | ||||
| Hello.
Here is a snippet of the code I am compiling(part of a commercial package):
template<class T>
class Vector
{
  protected:
   U32 mElementCount;
   U32 mArraySize;
   T*  mArray;
   bool  resize(U32);
  public:
   Vector(const U32 initialSize = 0);
   Vector(const U32 initialSize, const char* fileName, const U32 lineNum);
   Vector(const char* fileName, const U32 lineNum);
   Vector(const Vector&);
   ~Vector();
   typedef T        value_type;
   typedef T&       reference;
   typedef const T& const_reference;
   typedef T*       iterator;
   typedef const T* const_iterator;
   typedef S32    difference_type;
   typedef U32    size_type;
...
   void insert(iterator, const T&);
   void erase(iterator);
...
   void push_front(const T&);
   void push_back(const T&);
   void pop_front();
   void pop_back();
...
};
z:/torque/engine\core/tVector.h(102) : Error: type qualifiers and static can only appear in outermost array of function parameter
z:/torque/engine\core/tVector.h(110) : Error: type qualifiers and static can only appear in outermost array of function parameter
z:/torque/engine\core/tVector.h(111) : Error: type qualifiers and static can only appear in outermost array of function parameter
line 102 is at the insert() function
line 110 is the push_front()
line 111 is the push_back()
What am I missing here?  This library compiles fine with gcc, metrowerks, and visual c++.
Thanks.
 | ||||
| June 28, 2004Re: compiler bug? | ||||
|---|---|---|---|---|
| 
 | ||||
| Posted in reply to David Medlock | Can you reproduce a complete code snippet I can compile to see the problem? thanks! | |||
| June 28, 2004Re: compiler bug? | ||||
|---|---|---|---|---|
| 
 | ||||
| Posted in reply to Walter | Walter wrote:
> Can you reproduce a complete code snippet I can compile to see the problem?
> thanks!
> 
> 
Walter wrote:
> Can you reproduce a complete code snippet I can compile to see the problem?
> thanks!
>
>
Hello Walter.
First thanks for the great compiler(and the quick response).
The package I am compiling is Torque (www.garagegames.com).
Since it is fairly tight-coupled(house of cards!) I have reproduced what is the jist of the problem(see code below).
When you attempt to insert a static array as a template parameter it says no.  This seems a reasonable error to me but gcc compiles it.
I also tried to typedef ('block' type below), but that doesn't work either.
Since I am in essence porting this engine to your compiler, I could make some changes, but I wanted your thought on it.
Thanks again,
David Medlock
// begin code snippet
template<class T>class Vector
{
  public:
  void insert(T*, const T&) {;}
};
typedef unsigned int U32;
typedef unsigned int block[50];
int main( int argc, char** argv )
{
        Vector<U32[50]> int_vector;
	Vector<block>	int_block_vector;
}
 | |||
| June 28, 2004Re: compiler bug? | ||||
|---|---|---|---|---|
| 
 | ||||
| Posted in reply to David Medlock | I can take it from here, thanks! | |||
| June 29, 2004Re: compiler bug? | ||||
|---|---|---|---|---|
| 
 | ||||
| Posted in reply to Walter | Walter wrote:
> I can take it from here, thanks!
> 
> 
Cool!
Btw. not to pile anything else on you, but this also gives issues:
int a = 0;
if ( bool(a) ) a++;
is the C++ cast of bool(x) valid?
Thanks again,
David Medlock
 | |||
| June 29, 2004Re: compiler bug? | ||||
|---|---|---|---|---|
| 
 | ||||
| Posted in reply to David Medlock | "David Medlock" <amedlock@nospam.org> wrote in message news:cbqf8b$2ohp$1@digitaldaemon.com... > Walter wrote: > > I can take it from here, thanks! > > > > > > Cool! > > Btw. not to pile anything else on you, but this also gives issues: > > > int a = 0; > if ( bool(a) ) a++; > > is the C++ cast of bool(x) valid? Yes. | |||
Copyright © 1999-2021 by the D Language Foundation
  Permalink
Permalink Reply
Reply