<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW " title="NEW --- - Assertion failed: (!isDependentType() &amp;&amp; &quot;This doesn't make sense for dependent types&quot;), function isConstantSizeType" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24015&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=ftM6oPzZQsVjBTJEjq-LEuTfnvwUc3_syT0TABzXE5Y&s=dUhS-7u35CBsJHwWl1uavL2B6BajLQDz9vKVoQeqe3o&e=">24015</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failed: (!isDependentType() && "This doesn't make sense for dependent types"), function isConstantSizeType
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++11
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>stone@cs.hmc.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14546" name="attach_14546" title="Program to search for potentially constexpr VarDecls">attachment 14546</a> <a href="attachment.cgi?id=14546&action=edit" title="Program to search for potentially constexpr VarDecls">[details]</a></span>
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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>