https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121838

            Bug ID: 121838
           Summary: Comma concatenation extension is not correctly
                    disabled with standards conforming option
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: luigighiron at gmail dot com
  Target Milestone: ---

The following code is incorrectly preprocessed by GCC:

#define F(...),##__VA_ARGS__
#define G(X,...),##__VA_ARGS__
int main(){
    1 F()2;
    1 G()2;
}

When preprocessed with -std=c23 or -std=c++20 or newer this expands to:

int main(){
    1,2;
    1 2;
}

It seems like the disabling of this extension wasn't updated after omitting the
final comma in a variadic macro was standardized.

Reply via email to