<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 - Clang-CL ICE with explicit specialization in class scope"
   href="https://bugs.llvm.org/show_bug.cgi?id=37937">37937</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang-CL ICE with explicit specialization in class scope
          </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>Windows NT
          </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>steveire@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Given:

#include <utility>

template <typename T>
class MyTemplate
{
public:

    template<typename U>
    struct Convertible
    {
        static constexpr bool result = false;
    };

    template<>
    struct Convertible<void>
    {
        static constexpr bool result = std::is_same<void, T>::value;
        // enum {
        //     result = std::is_same<void, T>::value
        // };
    };

    template <typename U,
        typename std::enable_if<(Convertible<U>::result), int>::Type = 0>
        MyTemplate(MyTemplate<U>&& other);

};

MyTemplate<void> someFunc();

void foo()
{

    auto c = std::move(someFunc());
}


The result is:


C:\dev\src\playground\cpp\build>C:\dev\src\llvm\build\releaseprefix\msbuild-bin\CL.exe
/c /std:c++latest ..\templ_ice.cpp
templ_ice.cpp
Wrote crash dump file "C:\Users\stkelly\AppData\Local\Temp\cl.exe-0cb32b.dmp"
0x00007FF74A14B6D0 (0x000001E201380300 0x000001E21B0209A0 0x000001E200000000
0x000001E21D5E8170), llvm::Type::isIntegerTy, c:\dev\src\llvm\lib\ir\type.cpp,
line 57
0x00007FF74A97D277 (0x000001E21D5A81D8 0x000001E21B0209A0 0x0000001A4598C2C0
0x00000000000001D6), clang::CodeGen::CodeGenTypes::ConvertTypeForMem() + 0x27
bytes(s), c:\dev\src\llvm\tools\clang\lib\codegen\codegentypes.cpp, line 91 +
0x10 byte(s)
0x00007FF74A98E36A (0x000001E21D5A81D8 0x000001E21B0209A0 0x0000000000000000
0x000001E21B020601), clang::CodeGen::CodeGenModule::EmitNullConstant() + 0x7A
bytes(s), c:\dev\src\llvm\tools\clang\lib\codegen\cgexprconstant.cpp, line 2116
+ 0x14 byte(s)
0x00007FF74A9163C1 (0x0000000000000000 0x000001E21CC39678 0x0000001A4598C5D6
0x000001E21CC39678), clang::CodeGen::CodeGenModule::EmitGlobalVarDefinition() +
0x241 bytes(s), c:\dev\src\llvm\tools\clang\lib\codegen\codegenmodule.cpp, line
3199 + 0x15 byte(s)
0x00007FF74A91EAD2 (0x000001E21B02CC80 0x000001E21B020600 0x000001E21D5A81D8
0x000001E21B028060), clang::CodeGen::CodeGenModule::GetOrCreateLLVMGlobal() +
0x692 bytes(s), c:\dev\src\llvm\tools\clang\lib\codegen\codegenmodule.cpp, line
2825
0x00007FF74A91C096 (0x000001E21CDBE960 0x000001E21B028480 0x0000000000000001
0x000001E21B028060), clang::CodeGen::CodeGenModule::GetAddrOfGlobalVar() + 0xB6
bytes(s), c:\dev\src\llvm\tools\clang\lib\codegen\codegenmodule.cpp, line 2983
0x00007FF74A91B8DD (0x000001E21CDBE960 0x000001E21D5A81D8 0x000001E21CDBE970
0x00007FF74A1BAF9E), clang::CodeGen::CodeGenModule::GetAddrOfGlobal() + 0x13D
bytes(s), c:\dev\src\llvm\tools\clang\lib\codegen\codegenmodule.cpp, line 2918
+ 0xF byte(s)
0x00007FF74A914DDE (0x000001E21CDBE970 0x000001E21CDBE960 0x000001E21CDBE970
0x000001E21B027830), clang::CodeGen::CodeGenModule::EmitDeferred() + 0xBE
bytes(s), c:\dev\src\llvm\tools\clang\lib\codegen\codegenmodule.cpp, line 1692
+ 0xE byte(s)
0x00007FF74A92028E (0x0000001A4598DD29 0x000001E21B027830 0x000001E21B0990A0
0x000001E21B0215B0), clang::CodeGen::CodeGenModule::Release() + 0x3E bytes(s),
c:\dev\src\llvm\tools\clang\lib\codegen\codegenmodule.cpp, line 393
0x00007FF74C8CC3B7 (0x0000001A4598DD29 0x00007FF74BA21066 0x0000000000000000
0x0000001A4598DDF8), `anonymous
namespace'::CodeGeneratorImpl::HandleTranslationUnit() + 0x27 bytes(s),
c:\dev\src\llvm\tools\clang\lib\codegen\modulebuilder.cpp, line 269
0x00007FF74C8C82C9 (0x000001E21B0994E0 0x000001E21D5A77D0 0x000001E21B0215B0
0x000001E21B0990A0), clang::BackendConsumer::HandleTranslationUnit() + 0x79
bytes(s), c:\dev\src\llvm\tools\clang\lib\codegen\codegenaction.cpp, line 238
0x00007FF74BA1C7A7 (0x000001E21AFACF00 0x0000000000000000 0x000001E21AFACFD0
0x0000000000000000), clang::ParseAST() + 0x217 bytes(s),
c:\dev\src\llvm\tools\clang\lib\parse\parseast.cpp, line 171
0x00007FF74ADF0606 (0x000001E21AFACFD0 0x0000000000000000 0x0000000000000000
0x000001E21AFF3900), clang::ASTFrontendAction::ExecuteAction() + 0xA6 bytes(s),
c:\dev\src\llvm\tools\clang\lib\frontend\frontendaction.cpp, line 1011 + 0x2A
byte(s)
0x00007FF74ADF0498 (0x000001E21AFF38D0 0x00007FF74E1E2830 0x000001E21AFADA40
0xFFFFFFFFFFFFFFFF), clang::FrontendAction::Execute() + 0x48 bytes(s),
c:\dev\src\llvm\tools\clang\lib\frontend\frontendaction.cpp, line 914
0x00007FF74ADAC9CF (0x0000000000000000 0x0000000000000000 0x000001E21AFADA40
0x000001E21AFADA40), clang::CompilerInstance::ExecuteAction() + 0x3EF bytes(s),
c:\dev\src\llvm\tools\clang\lib\frontend\compilerinstance.cpp, line 990
0x00007FF74AE8AC0D (0x000001E21AFACFD0 0x000001E21AFD6070 0x000001E21AFF5FE0
0x000001E21AFACFD0), clang::ExecuteCompilerInvocation() + 0x77D bytes(s),
c:\dev\src\llvm\tools\clang\lib\frontendtool\executecompilerinvocation.cpp,
line 257 + 0xB byte(s)
0x00007FF748F9FF75 (0x00007FF748E02C56 0xFFFFFFFF7C000000 0x000034BB2C347145
0x0000001A4598E840), cc1_main() + 0x3B5 bytes(s),
c:\dev\src\llvm\tools\clang\tools\driver\cc1_main.cpp, line 222 + 0x8 byte(s)
0x00007FF748F99FED (0x00007FF74C94AE2C 0x0000001A4598EA58 0x0000001A4598E8F0
0x0000000000000000), ExecuteCC1Tool() + 0x5D bytes(s),
c:\dev\src\llvm\tools\clang\tools\driver\driver.cpp, line 320
0x00007FF748F9CEBE (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000), main() + 0x5CE bytes(s),
c:\dev\src\llvm\tools\clang\tools\driver\driver.cpp, line 382 + 0x59 byte(s)
0x00007FF74C70B5D5 (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000), __scrt_common_main_seh() + 0x11D bytes(s),
f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl, line 253 + 0x22 byte(s)
0x00007FFDA2F01FE4 (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)
0x00007FFDA4F7CB31 (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)
clang-cl.exe: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0 (<a href="https://git.llvm.org/git/clang.git/">https://git.llvm.org/git/clang.git/</a>
61eec74fca81791c7bb998f195ab0b77b8ed41ea) (<a href="https://git.llvm.org/git/llvm.git/">https://git.llvm.org/git/llvm.git/</a>
83f6dc20df0480404f10c25ee81711f0667725a1)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\dev\src\llvm\build\releaseprefix\msbuild-bin
clang-cl.exe: 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-cl.exe: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-cl.exe: note: diagnostic msg:
C:\Users\stkelly\AppData\Local\Temp\templ_ice-df3889.cpp
clang-cl.exe: note: diagnostic msg:
C:\Users\stkelly\AppData\Local\Temp\templ_ice-df3889.sh
clang-cl.exe: note: diagnostic msg:

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



MSVC (incorrectly, I think, for now) accepts this code. Clang on unix rejects
it: <a href="https://godbolt.org/g/fSd9FZ">https://godbolt.org/g/fSd9FZ</a></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>