0

I am trying to use gcc to essentially just check if a C++ program validly compiles without paying the cost of code generation. There is a very similar question here which suggests the -fsyntax-only flag.

This is very close to what I want, but unfortunately, apparently this will not instantiate templates which makes it unsuitable for my purposes.

Is there a way to convince gcc to go further, including all actions up to the actual code generation?

Chuu
  • 4,301
  • 2
  • 28
  • 54
  • How would it guess arguments for template parameters, should it try to instantiate templates with all possible parameter types and values combinations? – 273K Jun 14 '23 at 15:57
  • 1
    I think you are looking for `-S`. (`-E` preprocess only, `-S` preprocess & compile, `-c` preprocess compile assemble.) – Eljay Jun 14 '23 at 15:59
  • @273K My understanding, which could be very wrong, is that if it hits a piece of code that needs to instantiate a template it verifies an instantiation could be performed, but does not perform the actual instantiation. – Chuu Jun 14 '23 at 16:03

0 Answers0