[LLVMbugs] [Bug 20845] New: TypedefDecl pointer from TypedefType can point to uninstantiated template typedef

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 4 05:58:09 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20845

            Bug ID: 20845
           Summary: TypedefDecl pointer from TypedefType can point to
                    uninstantiated template typedef
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: schindler at virtamed.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Consider the following code: 


template<typename T> class Test
{
        typedef int size_type;

        void function(size_type value) {}
};

Test<int> instance;

When traversing the ast, I look at the CXXMethodDecl for
Test<int>::function(...), I do the following: 

auto param= decl->parameters()[0];
auto paramtype = param->getType();
TypedefType* td = paramtype.getTypePtr()->getAs<TypedefType>();
TypedefDecl* tddecl = td->getDecl();

The problem is that tddecl points to the TypedefDecl within the context of
ClassTemplateTecl and not the specific TypedefDecl of the
ClasstemplateSpecializationDecl. In case the typedef is dependent as well, this
problem does not occur. 

This is a problem because I have a clang-based tool where the context of the
TypedefDecl is important.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140904/16debd5c/attachment.html>


More information about the llvm-bugs mailing list