- 论坛徽章:
- 0
|
- #include <iostream>;
- using namespace std;
- template<class T>;
- class A
- {
- public:
- enum{
- number=10
- };
- static int a[number];
- public:
- void dump()
- {
- for (int i=0; i<A<T>;::number; i++)
- cout<<a[i]<<endl;
- }
- };
- template<class T>;
- int A<T>;::a[A<T>;::number]={1};
- int main()
- {
- A<char>; a;
- a.dump();
- return 0;
- }
复制代码
在C++ builder 6.0中运行正常,而hp-unix上aCC编译器却报错如下:
Error 195: "t.cpp", line 23 # Static member "int A::a[10]" was declared as 'int [10]' in class yet has type 'int [number]' here.
int A<T>;::a[A<T>;]={1};
请问会是什么问题呢?
|
|