[cfe-dev] Partial Template Specialization

Yang Chen chenyang at cs.utah.edu
Thu Apr 5 14:16:07 PDT 2012


I am writing a pass using ASTConsumer. I find that seems some 
declarations of partial template specializations  are missing from 
TranslationUnitDecl. For example, given the simple code below:

template<bool, typename>
struct AAA { };

template<typename T>
struct AAA<true, T>
{ };

I get the following result dumped from MyPass::HandleTranslationUnit() 
function, where MyPass is inherited from ASTConsumer.

(gdb) p Ctx.getTranslationUnitDecl()->dump()
struct __va_list_tag {
    unsigned int gp_offset;
    unsigned int fp_offset;
    void *overflow_arg_area;
    void *reg_save_area;
typedef struct __va_list_tag __va_list_tag;
template <typename > struct AAA {
$1 = void

In the above output, only template class AAA is presented, but the 
partial template specialization is missing.

Is this an expected behavior, or is it a Clang bug? Sorry for my vague 
description. Hopefully I am not missing anything.

- Yang

More information about the cfe-dev mailing list