static data member problem
Mark E.
snowball3@usa.net
Sat Sep 12 21:19:00 GMT 1998
The program below generates an "undefined reference to
container<char>::null_str_c" when STATIC is defined with egcs
1.1 for DJGPP. It seems perfectly legal to me, is the error correct
or have I found a bug?
#define STATIC
template <class charT>
class container
{
public:
typedef charT value_type;
#ifdef STATIC
static
#endif
value_type null_str_c;
const value_type* data() ;
};
template <class charT>
inline
const container<charT>::value_type *
container<charT>::
data ()
{
return &null_str_c;
}
#ifdef STATIC
template<class charT>
container<charT>::value_type
container<charT>::
null_str_c = static_cast<value_type>(0);
#endif
typedef container<char> cstring;
int main()
{
cstring v;
v.data();
return 0;
}
--
Mark E. snowball3@usa.net
http://members.xoom.com/snowball3/
More information about the Gcc-bugs
mailing list