-
-
Notifications
You must be signed in to change notification settings - Fork 262
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
I noticed this issue when playing with x-macros, this is a minimal example.
It does not depend on the complexity of the macro, and does not depend on #undef.
#undef X_MACRO
#define X_MACRO(iconid) iconid,
enum class icon_id {
X_MACRO(action)
X_MACRO(action2)
};
#undef X_MACRO
#define X_MACRO(iconid) case icon_id::iconid: return 0;
int to_int(icon_id id){
switch(id){
X_MACRO(action)
X_MACRO(action2)
}
}
I would expect it to expand to
#undef X_MACRO
#define X_MACRO(iconid) iconid,
enum class icon_id {
action,
action2,
};
#undef X_MACRO
#define X_MACRO(iconid) case icon_id::iconid: return 0;
int to_int(icon_id id) {
switch(id) {
case icon_id::action: return 0;
case icon_id::action2: return 0;
}
}
but it actually gets expanded to
#undef X_MACRO
#define X_MACRO(iconid) iconid,
enum class icon_id {
X_MACRO(action)
X_MACRO(action2)
};
#undef X_MACRO
#define X_MACRO(iconid) case icon_id::iconid: return 0;
int to_int(icon_id id) {
switch(id) {
case icon_id::action: return 0;
case icon_id::action2: return 0;
}
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working