<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 failure for trailing return type with variable declared below"
   href="http://llvm.org/bugs/show_bug.cgi?id=15418">15418</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failure for trailing return type with variable declared below
          </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++11
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>zeratul976@hotmail.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>When compiling the following code (which is invalid but only because of an
order-of-declarations issue, a mistake commonly made):


struct A { void operator()(int); };

struct S
{
    template <typename T>
    auto foo(T t) -> decltype(a(t));

    A a;
};


int main()
{   
    S().foo(0);
}


with clang r176405, I get the following assertion failure:


clang: llvm/include/llvm/Support/Casting.h:79: static bool
llvm::isa_impl_cl<clang::CXXMethodDecl, clang::FunctionDecl *>::doit(const From
*) [To = clang::CXXMethodDecl, From = clang::FunctionDecl *]: Assertion `Val &&
"isa<> used on a null pointer"' failed.
0  clang           0x0000000001e66485 llvm::sys::PrintStackTrace(_IO_FILE*) +
37
1  clang           0x0000000001e66973
2  libpthread.so.0 0x00007f303e8e78f0
3  libc.so.6       0x00007f303d9dab25 gsignal + 53
4  libc.so.6       0x00007f303d9de670 abort + 384
5  libc.so.6       0x00007f303d9d39f1 __assert_fail + 241
6  clang           0x0000000000af1590
clang::Sema::DiagnoseEmptyLookup(clang::Scope*, clang::CXXScopeSpec&,
clang::LookupResult&, clang::CorrectionCandidateCallback&,
clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>) + 7968
7  clang           0x0000000000bd2f77
8  clang           0x0000000000bc9cd2
9  clang           0x0000000000bc9c05
clang::Sema::BuildOverloadedCallExpr(clang::Scope*, clang::Expr*,
clang::UnresolvedLookupExpr*, clang::SourceLocation, clang::Expr**, unsigned
int, clang::SourceLocation, clang::Expr*, bool) + 597
10 clang           0x0000000000aebffc clang::Sema::ActOnCallExpr(clang::Scope*,
clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation, clang::Expr*, bool) + 1036
11 clang           0x0000000000c86f94
12 clang           0x0000000000c75ca8
13 clang           0x0000000000c6a1a2
14 clang           0x0000000000c87f2b
15 clang           0x0000000000c6d987
clang::Sema::SubstFunctionDeclType(clang::TypeSourceInfo*,
clang::MultiLevelTemplateArgumentList const&, clang::SourceLocation,
clang::DeclarationName, clang::CXXRecordDecl*, unsigned int) + 759
16 clang           0x0000000000c931ac
clang::TemplateDeclInstantiator::SubstFunctionType(clang::FunctionDecl*,
llvm::SmallVectorImpl<clang::ParmVarDecl*>&) + 252
17 clang           0x0000000000c90b7f
clang::TemplateDeclInstantiator::VisitCXXMethodDecl(clang::CXXMethodDecl*,
clang::TemplateParameterList*, bool) + 719
18 clang           0x0000000000c95cbe clang::Sema::SubstDecl(clang::Decl*,
clang::DeclContext*, clang::MultiLevelTemplateArgumentList const&) + 94
19 clang           0x0000000000c3f7f6
clang::Sema::FinishTemplateArgumentDeduction(clang::FunctionTemplateDecl*,
llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int,
clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&,
llvm::SmallVectorImpl<clang::Sema::OriginalCallArg> const*) + 1894
20 clang           0x0000000000c41db1
clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*,
clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>,
clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&) + 4497
21 clang           0x0000000000bbf8bf
clang::Sema::AddMethodTemplateCandidate(clang::FunctionTemplateDecl*,
clang::DeclAccessPair, clang::CXXRecordDecl*, clang::TemplateArgumentListInfo*,
clang::QualType, clang::Expr::Classification, llvm::ArrayRef<clang::Expr*>,
clang::OverloadCandidateSet&, bool) + 271
22 clang           0x0000000000bce106
clang::Sema::BuildCallToMemberFunction(clang::Scope*, clang::Expr*,
clang::SourceLocation, clang::Expr**, unsigned int, clang::SourceLocation) +
2262
23 clang           0x0000000000aec11c clang::Sema::ActOnCallExpr(clang::Scope*,
clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation, clang::Expr*, bool) + 1324
24 clang           0x000000000097836e
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) + 3198
25 clang           0x000000000097b7e3 clang::Parser::ParseCastExpression(bool,
bool, bool&, clang::Parser::TypeCastState) + 11987
26 clang           0x0000000000976454
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 132
27 clang           0x00000000009763b9
clang::Parser::ParseExpression(clang::Parser::TypeCastState) + 9
28 clang           0x00000000009a341c clang::Parser::ParseExprStatement() + 44
29 clang           0x00000000009a2f9c
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 2412
30 clang           0x00000000009a2591
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 145
31 clang           0x00000000009a9781
clang::Parser::ParseCompoundStatementBody(bool) + 1729
32 clang           0x00000000009aafcb
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 187
33 clang           0x0000000000946ae1
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
2065
34 clang           0x0000000000955a2e
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1374
35 clang           0x0000000000946178
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 664
36 clang           0x0000000000945bf0
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 416
37 clang           0x0000000000945160
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 2864
38 clang           0x00000000009445b0
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 304
39 clang           0x0000000000940d86 clang::ParseAST(clang::Sema&, bool, bool)
+ 454
40 clang           0x00000000007fc862 clang::CodeGenAction::ExecuteAction() +
194
41 clang           0x000000000068e211 clang::FrontendAction::Execute() + 113
42 clang           0x000000000066f1bd
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 909
43 clang           0x0000000000656539
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2969
44 clang           0x000000000064ccf5 cc1_main(char const**, char const**, char
const*, void*) + 693
45 clang           0x00000000006536c4 main + 7284
46 libc.so.6       0x00007f303d9c5c4d __libc_start_main + 253
47 clang           0x000000000064c909</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>