<html>
    <head>
      <base href="https://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 --- - function template/generic lambda/local class/member function/pack expansion => compiler crash"
   href="https://llvm.org/bugs/show_bug.cgi?id=22990">22990</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>function template/generic lambda/local class/member function/pack expansion => compiler crash
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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++14
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>alex.cossette@gmail.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>Attempts to expand parameter pack in a member function in a local class nested
in a generic lambda nested in a function template results in an assertion
failure and compiler crash.

template <class>
void f() {
    [](auto...a) {
        struct C {
            static void g() { f<decltype(a)...>(); }
        };
    }(0);
}

int main() {
    f<void>();
}

Assertion failed: (isa<LabelDecl>(D) && "declaration not instantiated in this
scope"), function findInstantiationOf, file SemaTemplateInstantiate.cpp, line
2802.
0  libLLVM-3.7svn.dylib     0x000000010e1438d5
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 57
1  libLLVM-3.7svn.dylib     0x000000010e143f70 SignalHandler(int) + 217
2  libsystem_platform.dylib 0x00007fff8b1c2f1a _sigtramp + 26
3  libsystem_platform.dylib 0x00007fff61ab0764 _sigtramp + 3599685732
4  libLLVM-3.7svn.dylib     0x000000010e143dff abort + 22
5  libLLVM-3.7svn.dylib     0x000000010e143de9 abort + 0
6  clang                    0x000000010d05f78e clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 61338
7  clang                    0x000000010d089d39
llvm::SmallVectorImpl<clang::Decl*>::operator=(llvm::SmallVectorImpl<clang::Decl*>
const&) + 7755
8  clang                    0x000000010d05fcd3 clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 62687
9  clang                    0x000000010d070a1d clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 131625
10 clang                    0x000000010d074c80 clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 148620
11 clang                    0x000000010d05c77d clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 49033
12 clang                    0x000000010d05b77a clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 44934
13 clang                    0x000000010d067adf clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 94955
14 clang                    0x000000010d05b6de clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 44778
15 clang                    0x000000010d08456b clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 212343
16 clang                    0x000000010d085078 clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 215172
17 clang                    0x000000010d0841c5 clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 211409
18 clang                    0x000000010d085078 clang::RValueReferenceType
const* clang::Type::getAs<clang::RValueReferenceType>() const + 215172
19 clang                    0x000000010cda11bf void
std::__1::__merge_move_construct<std::__1::__less<clang::CodeCompletionResult,
clang::CodeCompletionResult>&, clang::CodeCompletionResult*,
clang::CodeCompletionResult*>(clang::CodeCompletionResult*,
clang::CodeCompletionResult*, clang::CodeCompletionResult*,
clang::CodeCompletionResult*,
std::__1::iterator_traits<clang::CodeCompletionResult*>::value_type*,
std::__1::__less<clang::CodeCompletionResult, clang::CodeCompletionResult>&) +
51228
20 clang                    0x000000010cd6977c
llvm::SmallVectorTemplateBase<clang::ParsedTemplateArgument,
false>::grow(unsigned long) + 16958
21 clang                    0x000000010cd0c3a4 void
std::__1::vector<llvm::Type*, std::__1::allocator<llvm::Type*>
<span class="quote">>::__push_back_slow_path<llvm::Type* const&>(llvm::Type* const&&&) + 3444</span >
22 clang                    0x000000010ca5c225
std::__1::__tree<std::__1::__value_type<clang::edit::FileOffset,
clang::edit::EditedSource::FileEdit>,
std::__1::__map_value_compare<clang::edit::FileOffset,
std::__1::__value_type<clang::edit::FileOffset,
clang::edit::EditedSource::FileEdit>, std::__1::less<clang::edit::FileOffset>,
true>, std::__1::allocator<std::__1::__value_type<clang::edit::FileOffset,
clang::edit::EditedSource::FileEdit> >
<span class="quote">>::destroy(std::__1::__tree_node<std::__1::__value_type<clang::edit::FileOffset,</span >
clang::edit::EditedSource::FileEdit>, void*>*) + 5783
23 clang                    0x000000010ca36c01
std::__1::__vector_base<clang::CompilerInstance*,
std::__1::allocator<clang::CompilerInstance*> >::~__vector_base() + 14605
24 clang                    0x000000010ca093c0
std::__1::__tree<std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >, std::__1::less<std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> > >,
std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> > >
<span class="quote">>::__insert_node_at(std::__1::__tree_node_base<void*>*,</span >
std::__1::__tree_node_base<void*>*&, std::__1::__tree_node_base<void*>*) + 3462
25 clang                    0x000000010ca02094
26 clang                    0x000000010ca07dc5
std::__1::__split_buffer<llvm::SourceMgr::SrcBuffer,
std::__1::allocator<llvm::SourceMgr::SrcBuffer>&>::~__split_buffer() + 8165
27 libdyld.dylib            0x00007fff910975c9 start + 1
Stack dump:
0.    Program arguments: /usr/local/Cellar/llvm/HEAD/bin/clang -cc1 -triple
x86_64-apple-macosx10.10.0 -emit-obj -mrelax-all -disable-free -main-file-name
crash.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix
-mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2
-target-linker-version 242 -dwarf-column-info -resource-dir
/usr/local/Cellar/llvm/HEAD/bin/../lib/clang/3.7.0 -stdlib=libc++ -std=c++14
-fdeprecated-macro -fdebug-compilation-dir
/Users/alexk7/Downloads/clang+llvm-3.6.0-x86_64-apple-darwin/bin -ferror-limit
19 -fmessage-length 0 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime=macosx-10.10.0 -fencode-extended-block-signature
-fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -o
/var/folders/9j/5qbhhqtj76v08rf1rggznsrm0000gq/T/crash-3b0f13.o -x c++
/Users/alexk7/Documents/testcpp11/testcpp11/crash.cpp 
1.    <eof> parser at end of file
2.    /Users/alexk7/Documents/testcpp11/testcpp11/crash.cpp:2:6: instantiating
function definition 'f'
3.    /Users/alexk7/Documents/testcpp11/testcpp11/crash.cpp:5:16: instantiating
function definition 'g'
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.7.0  (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
00edfaecf079bd80ed9d26f6e97fcdfc936c6937)
Target: x86_64-apple-darwin14.1.0
Thread model: posix

Also tested in 3.5 and 3.6 with same result (without the stack trace).</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>