Skip to content

Instantly share code, notes, and snippets.

@nil-ableton
Last active Jun 7, 2016
Embed
What would you like to do?
spaces in macro and boost::icl
/*
Encountered while building with FASTbuild cache on a library using boost::icl
See element_iterator.hpp and ICL_INTERVAL_TYPE.
FASTbuild uses cl.exe -P to produce a pre-processed file. That file gets a const stitched onto it.
Steps to reproduce:
1- compile with cl.exe clmacro.cpp
2- compile with cl.exe -P -Ficlmacro.i.cpp clmacro.cpp && cl.exe clmacro.i.cpp
Expected:
- 1 & 2 compile
Observed:
- only 1 compiles
*/
#define funny_type(__x) __x
// this fixes it in MSVC:
#define funny_type_guard
#define funny_type2(__x) __x funny_type_guard
int main(void)
{
funny_type(int)const a = 2; // cl.exe -P clmacro.cpp -> `intconst a`
funny_type2(int)const b = 4; // cl.exe -P clmacro.cpp -> `int const b`
}
@gck-ableton
Copy link

gck-ableton commented Jun 7, 2016

Does this happen with cl.exe -E, too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment