In C ++ 11, when the form preprocessor directive ...
#if expr
..., expr is evaluated as constant-expression , as described in 16.1 [cpp.cond] .
This is done after replacing the macro with expr , its identifiers (and keywords) are replaced with 0, its preprocessing-tokens converted to tokens , the defined operator is evaluated, and so on.
My question is what happens when one of the tokens in expr is user-defined-literal ?
Custom literals are similar to function calls, but function calls cannot occur in expr (I think), as a side effect of identifier replacement. However, technically user-defined-literals can survive.
I suspect this is a mistake, but I cannot figure out how to conclude that from the standard?
Perhaps the (pedantic) effect of adding custom literals to section 16 [cpp] was simply ignored?
Or am I missing something?
Update:
To illustrate with an example:
What is this preprocess:
#if 123_foo + 5.5 > 100 bar #else baz #endif
bar or baz or is it a mistake?
GCC 4.7 reports:
test.cpp:1:5: error: user-defined literal in preprocessor expression
therefore, he believes that this is a mistake. Could this be justified with reference to the standard? Or is it just "implicit"?