Menu

#547 Remove braces introduces compile-time error

open
nobody
None
2021-03-08
2021-03-08
Pavel Celba
No

--remove-braces option introduces compile-time errors when macros are used in following way:

#define MY_MACRO {\
int a = 5;\
}

if (someCondition)
{
MY_MACRO;
}
else
{
MY_MACRO;
}
becomes:
if (someCondition)
MY_MACRO;
else
MY_MACRO;

resulting in C2181: illegal else without matching if (On VS2017, but I suspect this is general problem)

Discussion


Log in to post a comment.