<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 --- - Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed."
   href="http://llvm.org/bugs/show_bug.cgi?id=20761">20761</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </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++1y
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>hstong@ca.ibm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Assertion hit on typo in a variable template (which ends up declaring it as a
bit-field).

### SOURCE:
$ cat typoColon.cc 
struct A {
   template <class T> static const int x : sizeof(T);
};


### COMPILER INVOCATION AND OUTPUT:
$ clang -cc1 -x c++ -std=c++1y typoColon.cc 
clang: /build/clang/src/llvm/include/llvm/Support/Casting.h:237: typename
llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = clang::ValueDecl; Y
= clang::NamedDecl; typename llvm::cast_retty<X, Y*>::ret_type =
clang::ValueDecl*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of
incompatible type!"' failed.
0  clang           0x0000000003c87265 llvm::sys::PrintStackTrace(_IO_FILE*) +
38
1  clang           0x0000000003c874e2
2  clang           0x0000000003c86e88
3  libpthread.so.0 0x00007f02cd9db340
4  libc.so.6       0x00007f02ccc17f79 gsignal + 57
5  libc.so.6       0x00007f02ccc1b388 abort + 328
6  libc.so.6       0x00007f02ccc10e36
7  libc.so.6       0x00007f02ccc10ee2
8  clang           0x00000000017834de
9  clang           0x00000000017b4ee9
clang::Sema::ActOnCXXMemberDeclarator(clang::Scope*, clang::AccessSpecifier,
clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>,
clang::Expr*, clang::VirtSpecifiers const&, clang::InClassInitStyle) + 3561
10 clang           0x000000000162752d
clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier,
clang::AttributeList*, clang::Parser::ParsedTemplateInfo const&,
clang::ParsingDeclRAIIObject*) + 4981
11 clang           0x000000000166f7ea
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 360
12 clang           0x000000000166f61e
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 1026
13 clang           0x000000000166f203
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 209
14 clang           0x0000000001626731
clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier,
clang::AttributeList*, clang::Parser::ParsedTemplateInfo const&,
clang::ParsingDeclRAIIObject*) + 1401
15 clang           0x0000000001628d99
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) + 3271
16 clang           0x0000000001624f24
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&) + 7694
17 clang           0x0000000001611745
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 9067
18 clang           0x00000000015fa5b1
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 71
19 clang           0x00000000015faa57
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 189
20 clang           0x00000000015fa221
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 2911
21 clang           0x00000000015f9678
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 538
22 clang           0x00000000015f2e1f clang::ParseAST(clang::Sema&, bool, bool)
+ 399
23 clang           0x00000000010af8c4 clang::ASTFrontendAction::ExecuteAction()
+ 322
24 clang           0x00000000010af39f clang::FrontendAction::Execute() + 139
25 clang           0x00000000010799bd
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 721
26 clang           0x000000000103d1eb
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 993
27 clang           0x000000000102ad32 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 770
28 clang           0x0000000001037cbc
29 clang           0x00000000010380f0 main + 661
30 libc.so.6       0x00007f02ccc02ec5 __libc_start_main + 245
31 clang           0x0000000001029369
Stack dump:
0.    Program arguments: clang -cc1 -x c++ -std=c++1y typoColon.cc 
1.    typoColon.cc:2:53: current parser token ';'
2.    typoColon.cc:1:1: parsing struct/union/class body 'A'
Aborted (core dumped)


### COMPILER VERSION INFO:
$ clang++ -v
clang version 3.6.0 (trunk 215824)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Selected multilib: .;@m64</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>