<html>
    <head>
      <base href="http://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 --- - clang asserts in skipRValueSubobjectAdjustments"
   href="http://llvm.org/bugs/show_bug.cgi?id=18217">18217</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang asserts in skipRValueSubobjectAdjustments
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>ganna@apple.com
          </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>The following code triggers an assertion in clang TOT. The assertion is coming
from the jump diagnostic code; switch is necessary for reproduction.

$ cat ex.cpp
class X {
};

template <typename T>
class MyCl {
  T mem;
};

class Source {
  MyCl<X> m;
public:
  int getKind() const;
};

bool b;
template<typename TT>
static void foo(const Source &SF, MyCl<TT *> Source::*m) {
  switch (SF.getKind()) {
    case 1: return;
    case 2: break;
    case 3:
    case 4: return;
  };
  if (b) {
    auto &y = const_cast<MyCl<TT *> &>(SF.*m);
  }
}

int main(int argc, char **argv) {
}

$ clang -std=c++11 ex.cpp
Assertion failed: (BO->getRHS()->isRValue()), function
skipRValueSubobjectAdjustments, file
/Volumes/Data/ws/llvmgit/llvm/tools/clang/lib/AST/Expr.cpp, line 89.
0  clang                    0x000000010b34193e
llvm::sys::PrintStackTrace(__sFILE*) + 46
1  clang                    0x000000010b341c4b
PrintStackTraceSignalHandler(void*) + 27
2  clang                    0x000000010b341fdc SignalHandler(int) + 412
3  libsystem_platform.dylib 0x00007fff8a7b55aa _sigtramp + 26
4  libsystem_platform.dylib 0x00007fff560c3578 _sigtramp + 3415269352
5  clang                    0x000000010b341c7b raise + 27
6  clang                    0x000000010b341d32 abort + 18
7  clang                    0x000000010b341d11 __assert_rtn + 129
8  clang                    0x000000010cd0da60
clang::Expr::skipRValueSubobjectAdjustments(llvm::SmallVectorImpl<clang::Expr
const*>&, llvm::SmallVectorImpl<clang::SubobjectAdjustment>&) const + 752
9  clang                    0x000000010c49d6e0
GetDiagForGotoScopeDecl(clang::ASTContext&, clang::Decl const*) + 1200
10 clang                    0x000000010c49cd5e (anonymous
namespace)::JumpScopeChecker::BuildScopeInformation(clang::Decl*, unsigned
int&) + 62
11 clang                    0x000000010c49ad23 (anonymous
namespace)::JumpScopeChecker::BuildScopeInformation(clang::Stmt*, unsigned
int&) + 1731
12 clang                    0x000000010c49b335 (anonymous
namespace)::JumpScopeChecker::BuildScopeInformation(clang::Stmt*, unsigned
int&) + 3285
13 clang                    0x000000010c49b335 (anonymous
namespace)::JumpScopeChecker::BuildScopeInformation(clang::Stmt*, unsigned
int&) + 3285
14 clang                    0x000000010c49a54e (anonymous
namespace)::JumpScopeChecker::JumpScopeChecker(clang::Stmt*, clang::Sema&) +
222
15 clang                    0x000000010c49a295 (anonymous
namespace)::JumpScopeChecker::JumpScopeChecker(clang::Stmt*, clang::Sema&) + 37
16 clang                    0x000000010c49a238
clang::Sema::DiagnoseInvalidJumps(clang::Stmt*) + 56</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>