[cfe-dev] Getting the FieldDecl from a CXXDependentScopeMemberExpr

Douglas Gregor dgregor at apple.com
Thu Jun 23 08:24:33 PDT 2011


On Jun 22, 2011, at 11:49 PM, Adrien Chauve wrote:

> On Wed, Jun 22, 2011 at 20:26, Douglas Gregor <dgregor at apple.com> wrote:
>> 
>> On Jun 22, 2011, at 10:05 AM, Adrien Chauve wrote:
>> 
>>> Thanks a lot!
>>> 
>>> If I understand well, the AST is of little help for dependent names
>>> inside template classes.
>> 
>> Correct. The language is of little help here, either, since it's a fundamental part of the C++ template model.
>> 
>>> Is there any tool to deal with it? Without instanciation, can we do
>>> anything with class templates?
>> 
>> 
>> Not really. You could guess by looking into the primary templates, but the answers you get will be wrong if any specializations come along, and you may not even be able to get enough type information to determine which primary template to look in.
>> 
>>        - Doug
>> 
> 
> Thanks!
> 
> By any chance, would it be possible to try and instantiate a primary
> template with a list of dumb template parameter types (say ints), skip
> it if it fails, and if there is no specialization and the instatiation
> succeeds, draw some conclusions on the primary template?


There's no infrastructure for doing this, but it should be possible. However, I don't think you'd want to instantiate with ints… rather, you'd want to instantiate with some dummy type that doesn't imply any specific behavior.

However, it depends on your goals. It might just be easier to inspect the contents of the primary template directly, since there's a full AST there anyway.

	- Doug



More information about the cfe-dev mailing list