g++ 3.0.1: uninitialized int != 0

Markus Werle numerical.simulation@web.de
Wed Aug 22 02:04:00 GMT 2001


The integer k below does not default to zero with gcc-3.0.1
(Monday's version)
With gcc-3.0 this code here is OK.

#include <iostream>
using namespace std;

int g(int j) {
  cout << "standalone: " << j << endl;
  return j;
}

struct C;
typedef int (* FunctionPointer)(int);

struct C {
  template <FunctionPointer FP> int f(int j) {
    cout << "calling FP " << j << endl;
    return FP(j);
  }
};

int main() {
  C c;
  int k;
  int j = c.f<&g>(k);
}



More information about the Gcc-bugs mailing list