www.digitalmars.com         C & C++   DMDScript  

c++ - "type qualifiers and static ..." error

reply "W這dzimierz Skiba" <abx abx.art.pl> writes:
Compiling source here I found dm c++ returns error for some specific 
syntax:

static void Func(...)
{
  ...
  VECTOR const& E = Superellipsoid->Power;
                  ^
  source\super.cpp(480) : Error: type qualifiers and static can only appear   
  in outermost array of function parameter

This construction compiled fine with gcc (various ports), intel c++, visual
c++, 
borland c++ and two mac compilers. But error appeared in Digital Mars C++. 
Intentional or accidental ? Any idea ? I already solved it own way but I report
it 
here in case it can be a bug. VECTOR type is as follow:

#define DBL double
typedef DBL VECTOR[3];

Do you need more informations ?

ABX
Jan 21 2003
parent reply "Walter" <walter digitalmars.com> writes:
I fixed a similar problem in the latest beta. Try it and see if the problem
goes away, if not, a small reproducible example showing the problem would be
nice. -Walter

"W這dzimierz Skiba" <abx abx.art.pl> wrote in message
news:b0j4l9$2e0c$1 digitaldaemon.com...
 Compiling source here I found dm c++ returns error for some specific
 syntax:

 static void Func(...)
 {
   ...
   VECTOR const& E = Superellipsoid->Power;
                   ^
   source\super.cpp(480) : Error: type qualifiers and static can only

   in outermost array of function parameter

 This construction compiled fine with gcc (various ports), intel c++,

 borland c++ and two mac compilers. But error appeared in Digital Mars C++.
 Intentional or accidental ? Any idea ? I already solved it own way but I

 here in case it can be a bug. VECTOR type is as follow:

 #define DBL double
 typedef DBL VECTOR[3];

 Do you need more informations ?

 ABX

Jan 21 2003
parent reply "W這dzimierz Skiba" <abx abx.art.pl> writes:
"Walter" <walter digitalmars.com> wrote in
news:b0j4pn$2e78$1 digitaldaemon.com: 

 I fixed a similar problem in the latest beta. Try it and see if the
 problem goes away, if not, a small reproducible example showing the
 problem would be nice. -Walter

Ok. I have tested latest beta and the problem is still there but error message is different: "need explicit cast to convert". Here is small code similiar to original file as much as possible: typedef double VECTOR[3]; typedef struct Object_Struct OBJECT; struct Object_Struct { VECTOR Power; }; static void Superellipsoid_Normal(OBJECT *Object) { VECTOR const& E = Object->Power; } and here is command and output: sc -c source\super.cpp -odmdos\obj\src\super.obj -mn -6 -ff -WA -Ae VECTOR const& E = Object->Power; ^ source\super.cpp(11) : Error: need explicit cast to convert from: double ** to : double [const 3]* Above small code is still correctly compiled with other compilers. Should I additionally make posting follow http://www.digitalmars.com/bugs.html ? ABX
Jan 22 2003
parent "Walter" <walter digitalmars.com> writes:
I can take it from  here. Thanks! -Walter

"W這dzimierz Skiba" <abx abx.art.pl> wrote in message
news:b0m85a$14pq$1 digitaldaemon.com...
 "Walter" <walter digitalmars.com> wrote in
 news:b0j4pn$2e78$1 digitaldaemon.com:

 I fixed a similar problem in the latest beta. Try it and see if the
 problem goes away, if not, a small reproducible example showing the
 problem would be nice. -Walter

Ok. I have tested latest beta and the problem is still there but error

 different: "need explicit cast to convert". Here is small code similiar to

 file as much as possible:


     typedef double VECTOR[3];
     typedef struct Object_Struct OBJECT;

     struct Object_Struct
     {
       VECTOR Power;
     };

     static void Superellipsoid_Normal(OBJECT *Object)
     {
       VECTOR const& E = Object->Power;
     }

 and here is command and output:

   sc -c source\super.cpp -odmdos\obj\src\super.obj -mn -6 -ff -WA -Ae
     VECTOR const& E = Object->Power;
                                    ^
   source\super.cpp(11) : Error: need explicit cast to convert
   from: double **
   to  : double [const 3]*

 Above small code is still correctly compiled with other compilers.
 Should I additionally make posting follow

 ABX

Jan 22 2003