Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] CPPClassInstance vs CPPClassSpecialization

> Does anybody know why B<0> in the following code gets resolved to CPPClassInstance instead of
> CPPClassSpecialization?

We model explicit specializations as template instances (see
ICPPTemplateInstance.isExplicitSpecialization()).

It looks like it works something like this:

  - When CPPTemplates.resolveBinding(CPPTemplateId) processes the template-id
    of an explicit specialization definition, it calls CPPTemplates.instantiate() which
    creates a regular CPPClassInstance and adds it to the cache. It then adds the
    definition to the instance using addDefinition(), which causes it to start returning
    the explicit specialization's scope in getCompositeScope(), and therefore to start
    returning true for isExplicitSpecialization().

  - Subsequent calls to CPPTemplates.instantiate() with the same arguments return
    the cached instance (which is now an explicit specialization).

I can't say whether this design contributes to the stack overflow error until I debug it.

Regards,
Nate 		 	   		  

Back to the top