I’m trying to figure out if
g++ -fsyntax-only
does only syntax checking or if it expands templates too.
Thus, I ask stack overflow for help:
Is there a way to write a program so that syntactically it’s valid, but when template expansion is done, an error occurs?
Thanks!
Depends on whether your definition of syntactically valid is
g++‘s-fsyntax-onlyor not.The following simple test program illustrates this and, I believe, answers your question:
Attempting to build:
So yes,
-fsyntax-onlydoes perform template expansion.