<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 --- - crash on valid codegen'ing member class template with in-class initialized member"
   href="http://llvm.org/bugs/show_bug.cgi?id=19195">19195</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>crash on valid codegen'ing member class template with in-class initialized member
          </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>nlewycky@google.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>Testcase:

class Cls {
  Cls();
  template <typename> struct Templ {
    Templ() {}
    int initialized_member = 0;
  };
  Templ<int> trigger_instantiation;
};
Cls::Cls() {}

Crash:

nlewycky@ducttape:~$ llvm/Debug+Asserts/bin/clang -std=c++11 y.cc
clang: /usr/local/google/home/nlewycky/llvm/include/llvm/Support/Casting.h:95:
static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To =
clang::BinaryOperator; From = clang::Stmt]: Assertion `Val && "isa<> used on a
null pointer"' failed.
0  clang           0x000000000377cc8a llvm::sys::PrintStackTrace(_IO_FILE*) +
38
1  clang           0x000000000377cf07
2  clang           0x000000000377c8a1
3  libpthread.so.0 0x00007fae2a699cb0
4  libc.so.6       0x00007fae299d1425 gsignal + 53
5  libc.so.6       0x00007fae299d4b8b abort + 379
6  libc.so.6       0x00007fae299ca0ee
7  libc.so.6       0x00007fae299ca192
8  clang           0x0000000000fb29c9
9  clang           0x0000000000f9a2ba
10 clang           0x0000000000f8ed28
11 clang           0x0000000000f8acce
12 clang           0x0000000000fb75dd
13 clang           0x000000000137a33c
14 clang           0x0000000001369ce9
15 clang           0x000000000136ab5b
16 clang           0x000000000137ab09
17 clang           0x0000000001369ce9
18 clang           0x00000000013798a1
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 159
19 clang           0x00000000013228e9
clang::CodeGen::CodeGenFunction::EmitScalarInit(clang::Expr const*,
clang::ValueDecl const*, clang::CodeGen::LValue, bool) + 93
20 clang           0x000000000132509b
clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*,
clang::ValueDecl const*, clang::CodeGen::LValue, bool) + 425
21 clang           0x0000000001310025
clang::CodeGen::CodeGenFunction::EmitInitializerForField(clang::FieldDecl*,
clang::CodeGen::LValue, clang::Expr*, llvm::ArrayRef<clang::VarDecl*>) + 267
22 clang           0x000000000130ff0c
23 clang           0x000000000131155c
24 clang           0x00000000013122a5
clang::CodeGen::CodeGenFunction::EmitCtorPrologue(clang::CXXConstructorDecl
const*, clang::CXXCtorType, clang::CodeGen::FunctionArgList&) + 873
25 clang           0x00000000013107a7
clang::CodeGen::CodeGenFunction::EmitConstructorBody(clang::CodeGen::FunctionArgList&)
+ 619
26 clang           0x0000000001245d08
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 906
27 clang           0x00000000012f6b32
clang::CodeGen::CodeGenModule::EmitCXXConstructor(clang::CXXConstructorDecl
const*, clang::CXXCtorType) + 522
28 clang           0x0000000001255fad
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 263
29 clang           0x0000000001254bbc
clang::CodeGen::CodeGenModule::EmitDeferred() + 316
30 clang           0x0000000001251ccd clang::CodeGen::CodeGenModule::Release()
+ 25
31 clang           0x00000000011d55d5
32 clang           0x00000000011d1abf
33 clang           0x00000000013ed7e6 clang::ParseAST(clang::Sema&, bool, bool)
+ 783
34 clang           0x0000000000f4c6a0 clang::ASTFrontendAction::ExecuteAction()
+ 322
35 clang           0x00000000011d381c clang::CodeGenAction::ExecuteAction() +
1224
36 clang           0x0000000000f4c1d3 clang::FrontendAction::Execute() + 205
37 clang           0x0000000000f1c674
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 720
38 clang           0x0000000000ee4627
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1077
39 clang           0x0000000000ed3a73 cc1_main(char const**, char const**, char
const*, void*) + 636
40 clang           0x0000000000edfe7f main + 770
41 libc.so.6       0x00007fae299bc76d __libc_start_main + 237
42 clang           0x0000000000ed2139
Stack dump:
0.    Program arguments:
/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
y.cc -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.23.52.20130808 -resource-dir
/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/../lib/clang/3.5.0
-internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/backward
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/x86_64-linux-gnu/c++/4.6
-internal-isystem /usr/local/include -internal-isystem
/usr/local/google/home/nlewycky/llvm/Debug+Asserts/bin/../lib/clang/3.5.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-std=c++11 -fdeprecated-macro -fdebug-compilation-dir
/usr/local/google/home/nlewycky -ferror-limit 19 -fmessage-length 204
-mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /tmp/y-84b12e.o
-x c++ y.cc 
1.    <eof> parser at end of file
2.    Per-file LLVM IR generation
3.    y.cc:4:5: Generating code for declaration 'Cls::Templ<int>::Templ'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.5.0 (trunk 204082) (llvm/trunk 204081)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/y-139889.cpp
clang: note: diagnostic msg: /tmp/y-139889.sh
clang: note: diagnostic msg: 

********************</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>