Browse Source

BUG: Fixed member template test to not produce a test program that crashes when it runs.

Brad King 20 years ago
parent
commit
772b121a14
1 changed files with 5 additions and 4 deletions
  1. 5 4
      Source/kwsys/kwsysPlatformCxxTests.cxx

+ 5 - 4
Source/kwsys/kwsysPlatformCxxTests.cxx

@@ -86,14 +86,15 @@ template <class U>
 class A
 {
 public:
-  U* ptr;
-  template <class V> U m(V* p) { return *ptr = *p; }
+  U u;
+  A(): u(0) {}
+  template <class V> V m(V* p) { return *p = u; }
 };
 
 int main()
 {
-  A<int> a;
-  short s = 0;
+  A<short> a;
+  int s = 1;
   return a.m(&s);
 }
 #endif