Hi,
Take the following code sample:
------------------------------------------------
#define BREAK_GCC4_2
template<typename Op>
void foo(Op& op) { op(); }
class My {
public:
static void myOp() { }
void test() {
#ifdef BREAK_GCC4_2
foo(myOp);
#else
foo(My::myOp);
#endif
}
};
------------------------------------------------
It compiled fine under GCC 4.1 but fails under 4.2.0:
$ g++ -c test.cpp
test.cpp: In member function 'void My::test()':
test.cpp:12: error: invalid initialization of non-const reference of
type 'void (&)()' from a temporary of type 'void ()()'
test.cpp:4: error: in passing argument 1 of 'void foo(Op&) [with Op =
void ()()]'
We found an alternative way to make the code compile (comment out the
first line) which works with both versions, but I'm wondering whether
this should be reported as a bug or if it was intentional.
Thanks!
--
Daniel Drake
Brontes Technologies, A 3M Company
http://www.brontes3d.com/opensource