default argument bug ?
I'm trying to compile the following with Sun C++ 5.7 Patch 117830-07 2006/03/15, and it seems to miscompile it. Should print out 2 and 1,
but prints out 2. This code works fine with g++.
-Yozo
[code]
#include <iostream>
class x { };
template <class T> class z { };
template <> class z<double> {
public:
inline static double f() { return 1.0; }
};
template <> class z<x> {
public:
inline static double f() { return 2.0; }
};
template <class T> void func(double a = z<T>::f()) {
std::cout << a << std::endl;
}
int main(int argc, char **argv) {
func<x>();// should print out 2
func<double>(); // should print out 1
}
[/code]

