
On 2/25/13 6:13 PM, Steven Watanabe wrote:
AMDG
[snip]
First I think I discovered a bug either in your lib or in clang(with libc++) when compiling one of the documentation examples in C++11 mode.
I haven't tested much with clang in C++11 mode. I wasn't able to get libc++ working on Linux. Are you using the latest version: r83101? Also, exactly what version of clang are you using? I'll take a look at this later today.
Just updated to revision 83153 (boost sandbox), The problem remains. I am using Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn) Target: x86_64-apple-darwin12.2.0 Thread model: posix (the one which comes with XCode 4.6) If you like I can send you the output of running your test suite. [snip]
The problem is the way name lookup works. It's clear that draw can't be found in the template definition, since it isn't declared until later on. Argument dependent lookup usually works, but in this case, the only associated namespace is std (from std::ostream) and draw is defined in the global namespace. (Note that the built-in types have no associated namespaces). BOOST_TYPE_ERASURE_FREE will have exactly the same problem. The solution is add declarations of draw for all builtin types /before/ the definition of drawable.
Ok, this works, but makes it impossible to (reliably) define the concept in isolation. Quite a severe limitation. Is there any possibility to overcome this?
On researching a better solution I saw that you already added the convenience macros BOOST_TYPE_ERASURE_MEMBER and BOOST_TYPE_ERASURE_FREE, but didn't have much luck with them. Is there a compileable example where they are used somewhere?
libs/type_erasure/example/basic.cpp uses both. See also libs/type_erasure/test/member.cpp and libs/type_erasure/test/free.cpp.
I see. This seems to be another problem which has to do with the C++11 mode. Best regards Fabio