cdecl-plus icon indicating copy to clipboard operation
cdecl-plus copied to clipboard

Initializers support, not just pure decl

Open pyoneerC opened this issue 2 years ago • 1 comments

unnamed

pyoneerC avatar Jul 07 '23 20:07 pyoneerC

The problem with this is that C++ is a context-sensitive language. You can't generally tell what an expression means without the symbols. For example:

void* xy = templ<0>>3;

// if templ is a template, then this is parsed as
void* xy = (templ<0>) > 3

// if templ is not a template, then this is parsed as
void* xy = (templ < 0) >> 3;

To make this work, I would either have to hard-code a huge amount of symbols (or at least whether they are a template, type, or variable), or write a full C++ parser and take in standard library headers.

One alternative is to treat everything as a non-template by default, and require typename and template disambiguators everywhere.

eisenwave avatar Jul 07 '23 20:07 eisenwave