<div dir="ltr"><div style>With the following sample code:</div><div style><br></div><div style><div>template <class T, size_t extraSize ></div><div>struct OSS_STRUCTURE_PAD_DELTA : public T</div><div>{</div><div>   char pad[ extraSize ] ;</div>
<div>} ;</div><div><br></div><div style>and an ast visitor that calls getTypeSize():<br><br><div>bool VisitFieldDecl( FieldDecl * f )</div><div>{</div><div>   RecordDecl * r = f->getParent() ;</div><div>   const QualType & theMembersClassType = m_context.getRecordType( r ) ;</div>
<div><br></div><div>   TypeSourceInfo * pThisFieldSourceInfo = f->getTypeSourceInfo() ;</div><div><br></div><div>   TypeLoc thisFieldTypeLoc = pThisFieldSourceInfo->getTypeLoc() ;</div><div><br></div><div>   const QualType & thisFieldQualType = thisFieldTypeLoc.getType() ;</div>
<div><br></div><div>   size_t szInBits = m_context.getTypeSize( thisFieldQualType ) ;</div><div>   size_t offsetInBits = m_context.getFieldOffset( f ) ;</div><div><br></div><div>   cout</div><div>      << "[" << offsetInBits/8 << "]:\t"</div>
<div>      << theMembersClassType.getAsString( m_pp ) << "::" << thisFieldQualType.getAsString( m_pp ) << "\t" << f->getNameAsString()</div><div>      << "\tsize: " << szInBits/8 << endl ;</div>
<div>      ;</div><div><br></div><div>   return true ;</div><div>}</div><div><br></div>I get the following abort:</div></div><div><br></div><div>t.C:5:20: error: unknown type name 'size_t'</div><div>template <class T, size_t extraSize ></div>
<div>                   ^</div><div>Should not see dependent types</div><div>UNREACHABLE executed at /home/hotellnx94/peeterj/clang/sources/llvm/tools/clang/lib/AST/ASTContext.cpp:1322!</div><div><br></div><div>Program received signal SIGABRT, Aborted.</div>
<div>0x00002aaaab39ef45 in raise () from /lib64/libc.so.6</div><div>(gdb) where</div><div>#0  0x00002aaaab39ef45 in raise () from /lib64/libc.so.6</div><div>#1  0x00002aaaab3a0340 in abort () from /lib64/libc.so.6</div><div>
#2  0x0000000000f024b8 in llvm::llvm_unreachable_internal (msg=0x132c728 "Should not see dependent types",</div><div>    file=0x132bd18 "/home/hotellnx94/peeterj/clang/sources/llvm/tools/clang/lib/AST/ASTContext.cpp", line=1322)</div>
<div>    at /home/hotellnx94/peeterj/clang/sources/llvm/lib/Support/ErrorHandling.cpp:98</div><div>#3  0x0000000000c1c5e4 in clang::ASTContext::getTypeInfoImpl (this=0x1b36050, T=0x1b55aa0)</div><div>    at /home/hotellnx94/peeterj/clang/sources/llvm/tools/clang/lib/AST/ASTContext.cpp:1322</div>
<div>#4  0x0000000000c1c509 in clang::ASTContext::getTypeInfo (this=0x1b36050, T=0x1b55aa0)</div><div>    at /home/hotellnx94/peeterj/clang/sources/llvm/tools/clang/lib/AST/ASTContext.cpp:1301</div><div>#5  0x000000000046229d in clang::ASTContext::getTypeInfo (this=0x1b36050, T=...)</div>
<div>    at /home/hotellnx94/peeterj/clang/debug48rt/include/clang/AST/ASTContext.h:1473</div><div>#6  0x0000000000462221 in clang::ASTContext::getTypeSize (this=0x1b36050, T=...)</div><div>    at /home/hotellnx94/peeterj/clang/debug48rt/include/clang/AST/ASTContext.h:1478</div>
<div>#7  0x0000000000462068 in MyASTVisitor::VisitFieldDecl (this=0x7fffffffc010, f=0x1b55b00) at ./memberdumper.h:25</div><div>#8  0x0000000000461f75 in clang::RecursiveASTVisitor<MyASTVisitor>::WalkUpFromFieldDecl (this=0x7fffffffc010, D=0x1b55b00)</div>
<div>    at /home/hotellnx94/peeterj/clang/debug48rt/include/clang/AST/DeclNodes.inc:313</div><div>#9  0x00000000004208bd in clang::RecursiveASTVisitor<MyASTVisitor>::TraverseFieldDecl (this=0x7fffffffc010, D=0x1b55b00)</div>
<div>    at /home/hotellnx94/peeterj/clang/debug48rt/include/clang/AST/RecursiveASTVisitor.h:1665</div><div>#10 0x000000000041e0f4 in clang::RecursiveASTVisitor<MyASTVisitor>::TraverseDecl (this=0x7fffffffc010, D=0x1b55b00)</div>
<div>    at /home/hotellnx94/peeterj/clang/debug48rt/include/clang/AST/DeclNodes.inc:313</div><div>#11 0x0000000000421993 in clang::RecursiveASTVisitor<MyASTVisitor>::TraverseDeclContextHelper (this=0x7fffffffc010, DC=0x1b3e2d8)</div>
<div>    at /home/hotellnx94/peeterj/clang/debug48rt/include/clang/AST/RecursiveASTVisitor.h:1232</div><div>#12 0x000000000041fe5a in clang::RecursiveASTVisitor<MyASTVisitor>::TraverseCXXRecordDecl (this=0x7fffffffc010, D=0x1b3e2a0)</div>
<div>    at /home/hotellnx94/peeterj/clang/debug48rt/include/clang/AST/RecursiveASTVisitor.h:1588</div><div><br></div><div style>Is this a known problem?  I'm running a recent snapshot:</div><div style><br></div><div>
Path: .</div><div>URL: <a href="http://llvm.org/svn/llvm-project/llvm/trunk">http://llvm.org/svn/llvm-project/llvm/trunk</a></div><div>Repository Root: <a href="http://llvm.org/svn/llvm-project">http://llvm.org/svn/llvm-project</a></div>
<div>Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8</div><div>Revision: 175922</div><div>Node Kind: directory</div><div>Schedule: normal</div><div>Last Changed Author: ahatanak</div><div>Last Changed Rev: 175920</div>
<div>Last Changed Date: 2013-02-22 16:10:03 -0500 (Fri, 22 Feb 2013)</div><div>Properties Last Updated: 2013-02-22 16:49:48 -0500 (Fri, 22 Feb 2013)</div><div><br></div>-- <br>Peeter
</div>