[cfe-dev] Controlling delayed template parsing via pragma

Nico Rieck nico.rieck at gmail.com
Mon Mar 3 11:41:10 PST 2014


Currently delayed template parsing is enabled by default for Windows
because some Windows SDK headers and ATL require it (though forward
declaring "struct IUnknown;" seems to suffice for large parts of the
SDK, including 3D and multimedia). As it is implemented, delayed
template parsing is all-or-nothing and user code is forced to accept the
relaxed parsing rules.

I have been toying with the idea to make delayed template parsing
controllable via pragma so it can be enabled just for offending headers.
This pragma might take the following form with the default state
determined by -fdelayed-template-parsing:

  #pragma delayed_template_parsing(push, [on|off])
  #pragma delayed_template_parsing(pop)

This would be the first pragma to not delegate to Sema because this must
be handled in the parser.

Before I clean it up and put out a patch I'd like to get some feedback
on whether this direction taken is acceptable.

-Nico



More information about the cfe-dev mailing list