[llvm-bugs] [Bug 30538] New: Assertion `!T->isDependentType() && "should not see dependent types here"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 27 07:05:08 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30538

            Bug ID: 30538
           Summary: Assertion `!T->isDependentType() && "should not see
                    dependent types here"' failed.
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mcrosier at codeaurora.org
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

CReduced test case:

template <class, unsigned, unsigned> class BF32;
template <template <class, unsigned M, unsigned = M> class BF>
class CRBase {
  enum { BIT };
  BF<bool, BIT> Bit;
};
CRBase<BF32> CR;

Compile with: clang -O3 test.cpp

Should result in the below assertion failure.  However, gcc will report an
error and exit gracefully.

Clang assertion and back trace:

TemplateSpecializationType 0x6a5f1c0 'BF32<_Bool, BIT, BIT>' dependent BF32
|-TemplateArgument type '_Bool'
|-TemplateArgument expr
| `-ImplicitCastExpr 0x6a5f0a8 'unsigned int' <IntegralCast>
|   `-DeclRefExpr 0x6a5f080 'enum CRBase<BF32>::(anonymous at test.cpp:4:3)'
EnumConstant 0x6a5f010 'BIT' 'enum CRBase<BF32>::(anonymous at test.cpp:4:3)'
`-TemplateArgument expr
  `-SubstNonTypeTemplateParmExpr 0x6a37678 'enum CRBase::(anonymous at
test.cpp:4:3)'
    `-DeclRefExpr 0x6a37650 'enum CRBase::(anonymous at test.cpp:4:3)'
EnumConstant 0x6a375f0 'BIT' 'enum CRBase::(anonymous at test.cpp:4:3)'
clang-3.9:
/local/mnt/workspace/mrosier/llvm-community/llvm/tools/clang/include/clang/AST/TypeNodes.def:98:
clang::TypeInfo clang::ASTContext::getTypeInfoImpl(const clang::Type *) const:
Assertion `!T->isDependentType() && "should not see dependent types here"'
failed.
#0 0x0000000001a1e908 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x1a1e908)
#1 0x0000000001a1f4e6 SignalHandler(int)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x1a1f4e6)
#2 0x00007fd81d89dcb0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0xfcb0)
#3 0x00007fd81c427035 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x36035)
#4 0x00007fd81c42a79b abort (/lib/x86_64-linux-gnu/libc.so.6+0x3979b)
#5 0x00007fd81c41fe1e (/lib/x86_64-linux-gnu/libc.so.6+0x2ee1e)
#6 0x00007fd81c41fec2 (/lib/x86_64-linux-gnu/libc.so.6+0x2eec2)
#7 0x000000000309aced clang::ASTContext::getTypeInfoImpl(clang::Type const*)
const
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x309aced)
#8 0x0000000003099e7b clang::ASTContext::getTypeInfo(clang::Type const*) const
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x3099e7b)
#9 0x0000000003099c1c clang::ASTContext::getTypeInfoInChars(clang::Type const*)
const
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x3099c1c)
#10 0x000000000324c5f9 (anonymous
namespace)::ItaniumRecordLayoutBuilder::LayoutField(clang::FieldDecl const*,
bool)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x324c5f9)
#11 0x000000000324f410 (anonymous
namespace)::ItaniumRecordLayoutBuilder::LayoutFields(clang::RecordDecl const*)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x324f410)
#12 0x00000000032455b0 clang::ASTContext::getASTRecordLayout(clang::RecordDecl
const*) const
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x32455b0)
#13 0x0000000001bc0769
clang::CodeGen::CodeGenTypes::ComputeRecordLayout(clang::RecordDecl const*,
llvm::StructType*)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x1bc0769)
#14 0x0000000001c63833
clang::CodeGen::CodeGenTypes::ConvertRecordDeclType(clang::RecordDecl const*)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x1c63833)
#15 0x0000000001c6469c
clang::CodeGen::CodeGenTypes::getCGRecordLayout(clang::RecordDecl const*)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x1c6469c)
#16 0x0000000001c64854
clang::CodeGen::CodeGenTypes::isZeroInitializable(clang::QualType)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x1c64854)
#17 0x0000000001bb4a63
clang::CodeGen::CodeGenModule::EmitNullConstant(clang::QualType)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x1bb4a63)
#18 0x0000000001c17529
clang::CodeGen::CodeGenModule::EmitGlobalVarDefinition(clang::VarDecl const*,
bool)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x1c17529)
#19 0x0000000001c123fb
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x1c123fb)
#20 0x0000000001c18dc1
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x1c18dc1)
#21 0x0000000002242c20 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x2242c20)
#22 0x0000000002241d7c
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x2241d7c)
#23 0x00000000026a1254 clang::ParseAST(clang::Sema&, bool, bool)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x26a1254)
#24 0x0000000001f24f25 clang::FrontendAction::Execute()
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x1f24f25)
#25 0x0000000001eed7b1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x1eed7b1)
#26 0x0000000001fa921a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x1fa921a)
#27 0x00000000007cd4a1 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x7cd4a1)
#28 0x00000000007cc02b main
(/local/mnt/workspace/mrosier/llvm-community/install/bin/clang-3.9+0x7cc02b)
#29 0x00007fd81c4127ed __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x217ed)


GCC error:
test.cpp: In instantiation of ‘class CRBase<BF32>’:
test.cpp:7:14:   required from here
test.cpp:5:17: error: ‘CRBase<BF>::Bit’ has incomplete type
   BF<bool, BIT> Bit;
                 ^~~
test.cpp:1:44: note: declaration of ‘class BF32<bool, 0u, 0u>’
 template <class, unsigned, unsigned> class BF32;
                                            ^~~~

-- 
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/20160927/1950ab50/attachment.html>


More information about the llvm-bugs mailing list