J
Johannes Schaub (litb)
It looks to me as if the following header causes undefined behavior when
included multiple times in a program (in different TUs):
#include <boost/bind.hpp>
inline void g(int a) { }
inline void f() {
int n = 0;
boost::bind(&g, _1)(n);
}
Do I misread the Standard? It appears to say that the definition of "f" will
cause undefined behavior by 3.2/5b2, because the name "_1" will refer to
different entities in each definition of f.
boost defines _1 using an unnamed namespace, and phoenix defines _1 using
internal linkage, both yielding to different entities in different
translation units. Will this cause any practical problems with regard to the
inline function? Could a ODR-checking compiler (maybe one with link-time
optimization) give a diagnostic here?
Thanks for all insights!
included multiple times in a program (in different TUs):
#include <boost/bind.hpp>
inline void g(int a) { }
inline void f() {
int n = 0;
boost::bind(&g, _1)(n);
}
Do I misread the Standard? It appears to say that the definition of "f" will
cause undefined behavior by 3.2/5b2, because the name "_1" will refer to
different entities in each definition of f.
boost defines _1 using an unnamed namespace, and phoenix defines _1 using
internal linkage, both yielding to different entities in different
translation units. Will this cause any practical problems with regard to the
inline function? Could a ODR-checking compiler (maybe one with link-time
optimization) give a diagnostic here?
Thanks for all insights!