danmar / simplecpp

C++ preprocessor
BSD Zero Clause License
209 stars 83 forks source link

Syntax error with #if and designated initializer #297

Closed chrchr-github closed 1 year ago

chrchr-github commented 1 year ago

From the forum: https://sourceforge.net/p/cppcheck/discussion/general/thread/2cc604d687

struct S { int i; };
struct S s = {
#if 1
            .i = 1,
#endif
};
bar.cpp:3:0: error: Syntax error in #if [preprocessorErrorDirective]
#if 1
^

The tokens 1 and . are combined.