79695430

Date: 2025-07-09 09:59:21
Score: 2
Natty:
Report link
I am getting compilation issue with -std=c++17 or c++20 , why so ?

root@94275cd4851f:/workspace/*************# cat test.cpp 
#include <iostream>
#define JOURNAL_METHOD_VOID(...) myprint("tt", ##__VA_ARGS__)

void myprint(const char* str, ...) {
}

int main() {
    // JOURNAL_METHOD_VOID("1", "2", "3");
    JOURNAL_METHOD_VOID();
    return 0;
}

root@94275cd4851f:/workspace/*************#  g++ -std=c++17 -c test.cpp -o test_cpp17.o 2>&1
test.cpp: In function 'int main()':
test.cpp:2:61: error: expected primary-expression before ')' token
    2 | #define JOURNAL_METHOD_VOID(...) myprint("tt", ##__VA_ARGS__)
      |                                                             ^
test.cpp:9:5: note: in expansion of macro 'JOURNAL_METHOD_VOID'
    9 |     JOURNAL_METHOD_VOID();
      |     ^~~~~~~~~~~~~~~~~~~
I am getting compilation issue with -std=c++17 or c++20 , why so ?
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: Suraj Kumar