Steven Watanabe wrote:
AMDG
Tobias Schwinger
writes: Try the attached code - does it work for you? No it doesn't. None of the versions requiring implicit conversions worked. Did you by any chance compile with NDEBUG? It works with GCC4. And another overload would be good:
friend char operator,(T const&, reserved const&);
gcc 3.4.4 and msvc 8.0 are both unhappy, still.
What makes me wonder is that assert( !IS_VOID(nonvoid(),X) ); can't possibly work because there is no conversion from int to X.
Yes, that's strange -- I'm certain 'assert' works correctly. Making the cases that shouldn't work fail is probably easier than making those that should work pass, however. Using Comeau I get all cases pass except this one STATIC_ASSERT( !IS_VOID(X(),Y) ); not sure whether it should behave this way. Anyway, I wouldn't have expected it to be that difficult -- maybe we should use some "never-returns type" in place of 'void'... Regards, Tobias