[llvm-bugs] [Bug 37937] New: Clang-CL ICE with explicit specialization in class scope

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 26 01:21:03 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37937

            Bug ID: 37937
           Summary: Clang-CL ICE with explicit specialization in class
                    scope
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: steveire at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

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 (https://git.llvm.org/git/clang.git/
61eec74fca81791c7bb998f195ab0b77b8ed41ea) (https://git.llvm.org/git/llvm.git/
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
http://llvm.org/bugs/ 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: https://godbolt.org/g/fSd9FZ

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180626/161ffcea/attachment.html>


More information about the llvm-bugs mailing list