I can't figure out what is wrong with this code. When I pass 1 argument to LOG_INFO, it works fine, but fails with 0 arguments.
#define LOG_INFO(...) CLOG(INFO, "default", ##__VA_ARGS__)
LOG_INFO() << "Log using default file";
When I compile this code I get this error:
error:
expected primary-expression before ‘)’ token
This is what I did to debug it.
When I run g++ -E on this file, LOG_INFO() IS expanded correctly:
CLOG(INFO, "default") << "Log using default file";
When I replace
LOG_INFO() << "Log using default file";
with
CLOG(INFO, "default") << "Log using default file";
It compiles fine! But when I put back the pre-expansion macro, it fails again.
To answer commentators: Here's the definition of CLOG
#define CLOG(LEVEL, ...)\
C##LEVEL(el::base::Writer, el::base::DispatchAction::NormalLog, __VA_ARGS__)
full file can be found here:
https://github.com/easylogging/easyloggingpp/blob/master/src/easylogging%2B%2B.h
running: gcc version 4.7.2 (Debian 4.7.2-5)