[LLVMbugs] [Bug 24015] New: Assertion failed: (!isDependentType() && "This doesn't make sense for dependent types"), function isConstantSizeType

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 1 23:30:07 PDT 2015


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

            Bug ID: 24015
           Summary: Assertion failed: (!isDependentType() && "This doesn't
                    make sense for dependent types"), function
                    isConstantSizeType
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: stone at cs.hmc.edu
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 14546
  --> https://llvm.org/bugs/attachment.cgi?id=14546&action=edit
Program to search for potentially constexpr VarDecls

The attached demo.cpp uses libtooling to search for "potentially constexpr"
VarDecls in code. When processing the following header-file contents:

/////////////////////////
template <typename T>
struct MyStruct {
  static void f() {
    unsigned AllocSize = static_cast<unsigned>(sizeof(MyStruct));
  }
};
/////////////////////////

the demo program crashes with an assertion failure, apparently triggered by
calling isCXX11ConstantExpr on that static_cast expression. 

Assertion failed: (!isDependentType() && "This doesn't make sense for dependent
types"), function isConstantSizeType, file
/Users/stone/llvm/tools/clang/lib/AST/Type.cpp, line 896.
0  demo                     0x000000010ea27079
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 57
1  demo                     0x000000010ea27c6b SignalHandler(int) + 875
2  libsystem_platform.dylib 0x00007fff992d9f1a _sigtramp + 26
3  demo                     0x000000010ebffe60 nuls + 31584
4  demo                     0x000000010ea27856 abort + 22
5  demo                     0x000000010ea27831 __assert_rtn + 81
6  demo                     0x000000010e836852
clang::Type::isConstantSizeType() const + 130
7  demo                     0x000000010e784e9e HandleSizeof((anonymous
namespace)::EvalInfo&, clang::SourceLocation, clang::QualType,
clang::CharUnits&) + 126
8  demo                     0x000000010e77c7ca
clang::StmtVisitorBase<clang::make_const_ptr, (anonymous
namespace)::IntExprEvaluator, bool>::Visit(clang::Stmt const*) + 6026
9  demo                     0x000000010e787c5d (anonymous
namespace)::IntExprEvaluator::VisitCastExpr(clang::CastExpr const*) + 1037
10 demo                     0x000000010e77b70f
clang::StmtVisitorBase<clang::make_const_ptr, (anonymous
namespace)::IntExprEvaluator, bool>::Visit(clang::Stmt const*) + 1743
11 demo                     0x000000010e787926 (anonymous
namespace)::IntExprEvaluator::VisitCastExpr(clang::CastExpr const*) + 214
12 demo                     0x000000010e77b70f
clang::StmtVisitorBase<clang::make_const_ptr, (anonymous
namespace)::IntExprEvaluator, bool>::Visit(clang::Stmt const*) + 1743
13 demo                     0x000000010e7740ea Evaluate(clang::APValue&,
(anonymous namespace)::EvalInfo&, clang::Expr const*) + 442
14 demo                     0x000000010e76ff71 EvaluateAsRValue((anonymous
namespace)::EvalInfo&, clang::Expr const*, clang::APValue&) + 97
15 demo                     0x000000010e7738ed
clang::Expr::isCXX11ConstantExpr(clang::ASTContext const&, clang::APValue*,
clang::SourceLocation*) const + 429
16 demo                     0x000000010dde649c
ProcessVarDecl::run(clang::ast_matchers::MatchFinder::MatchResult const&) + 76
...



If the "template <typename T>" line is removed from the input, the demo program
runs successfully.

-- 
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/20150702/6d71e35a/attachment.html>


More information about the llvm-bugs mailing list