Is this a bug?

Lev Assinovsky LAssinovsky@algorithm.aelita.com
Tue Aug 12 16:27:00 GMT 2003


gcc 3.2.3, HPUX-11.00:

typedef struct  { int a, b; } item; 
class A {
public:
    static const item *  f()
        {
            static const item  arr[] = {{0,0}}; 
            return arr;
        }
};

The result:

t.cpp: In static member function `static const item* A::f()':
t.cpp:6: warning: sorry: semantics of inline function static data `const item 
   arr[1]' are wrong (you'll wind up with multiple copies)
t.cpp:6: warning:   you can work around this by removing the initializer

----
Lev Assinovsky
Aelita Software Corporation
O&S Core Division, Programmer
ICQ# 165072909



More information about the Gcc-help mailing list