Namespace or template inside ifdef causing false syntax errors
Closed this issue · 2 comments
mayshukla commented
Example:
#ifdef A
namespace foo {
int i;
}
#endif
Output:
tmp.cpp:2:1: error: expected unqualified-id
namespace foo {
^
namespace foo {
int i; // In context: A
}// In context: A
1 error generated.
Note that this error is only emitted if namespace
is the first thing inside the ifdef
mayshukla commented
This issue also occurs when there is a template
keyword immediately after #ifdef
For example:
#ifdef A
template <typename T>
void foo() {}
#endif
Output:
error: expected unqualified-id
template <typename T>
^
1 error generated.