<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - An ICE given some parameters and templates"
   href="https://bugs.llvm.org/show_bug.cgi?id=42205">42205</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>An ICE given some parameters and templates
          </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>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>zhonghao@pku.org.cn
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>My clang is 9.0.0, and my code is:

template <class> bool a;
template <typename> struct b;
struct B {
 template <typename... e> static auto d = a<e...>;
 template <typename... e> static auto d<b<e...>> = d<e...>;
} c;

With clang -g and  clang++ -Weffc++ -gsplit-dwarf, I got the following ICE:

Stack dump:
0.      Program arguments: /usr/local/lib/clang8/bin/clang-9 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name code2.c.cpp
-mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array
-target-cpu x86-64 -dwarf-column-info -enable-split-dwarf
-debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -ggnu-pubnames
-split-dwarf-file code2.dwo -resource-dir /usr/local/lib/clang8/lib/clang/9.0.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/x86_64-linux-gnu/c++/7.4.0
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0/../../../../include/c++/7.4.0/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/lib/clang8/lib/clang/9.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -Weffc++ -fdeprecated-macro
-fdebug-compilation-dir /home/haozhong -ferror-limit 19 -fmessage-length 0
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -faddrsig -o /tmp/code2-9ca9c5.o -x c++
/home/haozhong/project/approach/compilerpara/llvm/tmp/llvm_38004/code2.c.cpp 
1.      <eof> parser at end of file
2.     
/home/haozhong/project/approach/compilerpara/llvm/tmp/llvm_38004/code2.c.cpp:3:8:
LLVM IR generation of declaration 'B'
3.     
/home/haozhong/project/approach/compilerpara/llvm/tmp/llvm_38004/code2.c.cpp:6:3:
Generating code for declaration 'c'
 #0 0x000055a25a05254a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/lib/clang8/bin/clang-9+0x169b54a)
 #1 0x000055a25a050314 llvm::sys::RunSignalHandlers()
(/usr/local/lib/clang8/bin/clang-9+0x1699314)
 #2 0x000055a25a050452 SignalHandler(int)
(/usr/local/lib/clang8/bin/clang-9+0x1699452)
 #3 0x00007f1b6b3ca890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x000055a25a2736a8 UnwrapTypeForDebugInfo(clang::QualType,
clang::ASTContext const&) (/usr/local/lib/clang8/bin/clang-9+0x18bc6a8)
 #5 0x000055a25a2814cb
clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType, llvm::DIFile*)
(/usr/local/lib/clang8/bin/clang-9+0x18ca4cb)
 #6 0x000055a25a28346b
clang::CodeGen::CGDebugInfo::CreateRecordStaticField(clang::VarDecl const*,
llvm::DIType*, clang::RecordDecl const*)
(/usr/local/lib/clang8/bin/clang-9+0x18cc46b)
 #7 0x000055a25a283d4b
clang::CodeGen::CGDebugInfo::CollectRecordFields(clang::RecordDecl const*,
llvm::DIFile*, llvm::SmallVectorImpl<llvm::Metadata*>&, llvm::DICompositeType*)
(/usr/local/lib/clang8/bin/clang-9+0x18ccd4b)
 #8 0x000055a25a280cb9
clang::CodeGen::CGDebugInfo::CreateTypeDefinition(clang::RecordType const*)
(/usr/local/lib/clang8/bin/clang-9+0x18c9cb9)
 #9 0x000055a25a281516
clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType, llvm::DIFile*)
(/usr/local/lib/clang8/bin/clang-9+0x18ca516)
#10 0x000055a25a28c7ff
clang::CodeGen::CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable*,
clang::VarDecl const*) (/usr/local/lib/clang8/bin/clang-9+0x18d57ff)
#11 0x000055a25a31575b
clang::CodeGen::CodeGenModule::EmitGlobalVarDefinition(clang::VarDecl const*,
bool) (/usr/local/lib/clang8/bin/clang-9+0x195e75b)
#12 0x000055a25a32d402
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/local/lib/clang8/bin/clang-9+0x1976402)
#13 0x000055a25a32dbf3
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl)
(/usr/local/lib/clang8/bin/clang-9+0x1976bf3)
#14 0x000055a25a332ad7
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.4529)
(/usr/local/lib/clang8/bin/clang-9+0x197bad7)
#15 0x000055a25ac416b3 (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef)
(/usr/local/lib/clang8/bin/clang-9+0x228a6b3)
#16 0x000055a25ac36386
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef)
(/usr/local/lib/clang8/bin/clang-9+0x227f386)
#17 0x000055a25b7401c4 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/lib/clang8/bin/clang-9+0x2d891c4)
#18 0x000055a25ac3e737 clang::CodeGenAction::ExecuteAction()
(/usr/local/lib/clang8/bin/clang-9+0x2287737)
#19 0x000055a25a70d8f6 clang::FrontendAction::Execute()
(/usr/local/lib/clang8/bin/clang-9+0x1d568f6)
#20 0x000055a25a6d00ac
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/lib/clang8/bin/clang-9+0x1d190ac)
#21 0x000055a25a7ccbe3
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/lib/clang8/bin/clang-9+0x1e15be3)
#22 0x000055a259252170 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/lib/clang8/bin/clang-9+0x89b170)
#23 0x000055a2591f0132 main (/usr/local/lib/clang8/bin/clang-9+0x839132)
#24 0x00007f1b6a4a5b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#25 0x000055a25924f98a _start (/usr/local/lib/clang8/bin/clang-9+0x89898a)
clang-9: error: unable to execute command: Segmentation fault (core dumped)
clang-9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 9.0.0 (trunk 362565) (llvm/trunk 362564)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-9: note: diagnostic msg: PLEASE submit a bug report to
<a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash backtrace, preprocessed source,
and associated run script.
clang-9: note: diagnostic msg: 
********************

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

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

Gcc rejects the code:

error: explicit template argument list not allowed
    5 |  template <typename... e> static auto d<b<e...>> = d<e...>;
      |                                       ^~~~~~~~~~

------------------------------------------------

With some other parameters ( clang++ -O3), clang accepts the code.</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>