------- Additional Comments From squell at alumina dot nl 2005-07-23 01:59 ------- When I changed the function body by removing all "foo::" qualifiers, I got the following;
int foo::f() { f_obj<&f> a; // ERROR: missing '>' in template argument list f_obj<f> b; // ERROR: foo::f in constant expression f_obj<&g> c; // OK f_obj<g> d; // OK } gcc 3.3 also gave an error on those two lines, complaining that "&this->foo::f" is not a valid template argument. I can't find why it says so - it's a constant expression and it should overload resolve it. However, g++ _is_ correct in transforming 'f' to "this->foo::f" in the first case to "foo::g" in the second (with or without explicit "foo::"). So I think this test-case can be reduced to (fails on 3.4 and 4.0): struct foo { static int f(); } *ptr; template<int fun()> struct bar { }; bar< ptr->f > a; // ERROR: `->' cannot appear in constant expression bar< &ptr->f > b; // ERROR: '>' missing in template argument -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22621