<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 crashes on simple code"
   href="http://llvm.org/bugs/show_bug.cgi?id=19101">19101</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang crashes on simple code
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.2
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>marekrusinowski@gmail.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>Created attachment 32329 [details]
Preprocessed source

(Crashes gcc too, bug report:
<a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60493">http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60493</a>)

This simple incorrect code (works here to: <a href="http://ideone.com/QPwEPO">http://ideone.com/QPwEPO</a>):


  #include <iterator>

  template <class T>
  class Splay {
    public:
      class iterator;
  };

  template <class T, class D>
  class Splay<T>::iterator : std::iterator<std::forward_iterator_tag, D> {
  };

  Splay<int>::iterator it;


Crashes clang with output:


gcc_segfault.cpp:9:1: error: too many template parameters in template
redeclaration
    template <class T, class D>
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    gcc_segfault.cpp:3:1: note: previous template declaration is here
    template <class T>
    ^~~~~~~~~~~~~~~~~~
    0  libLLVM-3.2.so.1 0x00002affdc0038df
    1  libLLVM-3.2.so.1 0x00002affdc003d49
    2  libpthread.so.0  0x00002affdca11880
    3  clang            0x0000000000f853c0 clang::TagType::getDecl() const + 0
    4  clang            0x00000000009ab044
    5  clang            0x00000000009c17a3
clang::Sema::DeclareImplicitCopyConstructor(clang::CXXRecordDecl*) + 643
    6  clang            0x0000000000a7dfbb
clang::Sema::LookupConstructors(clang::CXXRecordDecl*) + 251
    7  clang            0x0000000000a67005
    8  clang            0x0000000000a70942
clang::InitializationSequence::InitializationSequence(clang::Sema&,
clang::InitializedEntity const&, clang::InitializationKind const&,
clang::Expr**, unsigned int) + 1522
    9  clang            0x0000000000977c7c
clang::Sema::ActOnUninitializedDecl(clang::Decl*, bool) + 428
    10 clang            0x00000000008861fb
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&) + 203
    11 clang            0x000000000088eaa4
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 420
    12 clang            0x000000000087d914
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 228
    13 clang            0x000000000087e0a9
    14 clang            0x000000000087e0df
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 31
    15 clang            0x000000000087f583
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 83
    16 clang            0x000000000088021f
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 191
    17 clang            0x000000000087886a clang::ParseAST(clang::Sema&, bool,
bool) + 266
    18 clang            0x0000000000618101 clang::FrontendAction::Execute() +
97
    19 clang            0x00000000005ff6ea
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 282
    20 clang            0x00000000005e9152
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1378
    21 clang            0x00000000005e4258 cc1_main(char const**, char const**,
char const*, void*) + 1144
    22 clang            0x00000000005e313f main + 7247
    23 libc.so.6        0x00002affdd869b45 __libc_start_main + 245
    24 clang            0x00000000005e3c67
    Stack dump:
    0.  Program arguments: /usr/bin/clang -cc1 -triple x86_64-pc-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
gcc_segfault.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -target-linker-version 2.23.52.20130727
-momit-leaf-frame-pointer -resource-dir /usr/bin/../lib/clang/3.2
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/x86_64-linux-gnu
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8/x86_64-linux-gnu
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8/backward
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8/x86_64-linux-gnu
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8/backward
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/x86_64-linux-gnu
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.2/include -internal-isystem
/usr/include/clang/3.2/include/ -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir /home/p2004a -ferror-limit 19
-fmessage-length 238 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/gcc_segfault-odFUkb.o -x c++ gcc_segfault.cpp 
    1.  gcc_segfault.cpp:13:24: current parser token ';'
    clang: error: unable to execute command: Segmentation fault
    clang: error: clang frontend command failed due to signal (use -v to see
invocation)
    Debian clang version 3.2-11 (tags/RELEASE_32/final) (based on LLVM 3.2)
    Target: x86_64-pc-linux-gnu
    Thread model: posix
    clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://bugs.debian.org/">http://bugs.debian.org/</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/gcc_segfault-Nm2Ct7.cpp
    clang: note: diagnostic msg: /tmp/gcc_segfault-Nm2Ct7.sh
    clang: note: diagnostic msg: 

    ********************



Proccessed source (/tmp/gcc_segfault-Nm2Ct7.cpp) in attachment.
clang version:
Debian clang version 3.2-11 (tags/RELEASE_32/final) (based on LLVM 3.2)
Target: x86_64-pc-linux-gnu
Thread model: posix</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>