<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 --- - Crash during CodeGen for DebugInfo with __uuidof in template argument"
   href="http://llvm.org/bugs/show_bug.cgi?id=16939">16939</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash during CodeGen for DebugInfo with __uuidof in template argument
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>david.majnemer@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>consider:
struct __declspec(uuid("{12345678-1234-1234-1234-1234567890aB}")) uuid;

template <const struct _GUID *>
struct thing {
};

thing<&__uuidof(uuid)> y;

run with:
./llvm/build/bin/clang -cc1 -x c++ testcase.cpp -fms-extensions -cxx-abi
microsoft -S -o - -g

gives us:
UNREACHABLE executed at
./llvm/src/tools/clang/lib/CodeGen/CGDebugInfo.cpp:1297!
0  clang           0x0000000001b8dbee llvm::sys::PrintStackTrace(_IO_FILE*) +
46
1  clang           0x0000000001b8deab
2  clang           0x0000000001b8e11e
3  libpthread.so.0 0x00007f0ba81cecb0
4  libc.so.6       0x00007f0ba740d425 gsignal + 53
5  libc.so.6       0x00007f0ba7410b8b abort + 379
6  clang           0x0000000001b4bbf6
7  clang           0x0000000001be1b50
clang::CodeGen::CGDebugInfo::CollectTemplateParams(clang::TemplateParameterList
const*, llvm::ArrayRef<clang::TemplateArgument>, llvm::DIFile) + 3344
8  clang           0x0000000001be1cbe
clang::CodeGen::CGDebugInfo::CollectCXXTemplateParams(clang::ClassTemplateSpecializationDecl
const*, llvm::DIFile) + 190
9  clang           0x0000000001be6506
clang::CodeGen::CGDebugInfo::CreateLimitedType(clang::RecordType const*) + 2374
10 clang           0x0000000001bdd743
clang::CodeGen::CGDebugInfo::getOrCreateLimitedType(clang::RecordType const*,
llvm::DIFile) + 147
11 clang           0x0000000001be24b9
clang::CodeGen::CGDebugInfo::CreateType(clang::RecordType const*, bool) + 297
12 clang           0x0000000001be58ab
clang::CodeGen::CGDebugInfo::CreateTypeNode(clang::QualType, llvm::DIFile,
bool) + 715
13 clang           0x0000000001bda65a
clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType, llvm::DIFile,
bool) + 442
14 clang           0x0000000001bebe70
clang::CodeGen::CGDebugInfo::EmitGlobalVariable(llvm::GlobalVariable*,
clang::VarDecl const*) + 960
15 clang           0x0000000001c5318c
clang::CodeGen::CodeGenModule::EmitGlobalVarDefinition(clang::VarDecl const*) +
2092
16 clang           0x0000000001c4fcdf
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 575
17 clang           0x0000000001c51b8c
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 764
18 clang           0x0000000001c53f54
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 356
19 clang           0x0000000001bd3be4
20 clang           0x0000000001bd1e28
21 clang           0x000000000202ec9c clang::ParseAST(clang::Sema&, bool, bool)
+ 524
22 clang           0x0000000001ef8209 clang::ASTFrontendAction::ExecuteAction()
+ 345
23 clang           0x0000000001bd116e clang::CodeGenAction::ExecuteAction() +
1246
24 clang           0x0000000001ef7d2f clang::FrontendAction::Execute() + 191
25 clang           0x0000000001ecb740
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 800
26 clang           0x0000000001b95088
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1048
27 clang           0x000000000082cc4a cc1_main(char const**, char const**, char
const*, void*) + 698
28 clang           0x0000000000825a42 main + 578
29 libc.so.6       0x00007f0ba73f876d __libc_start_main + 237

It would seem that CGDebugInfo::CollectTemplateParams believes that it should
never get a TemplateArgument::Expression and yet, it's getting one.

I'm not entirely surprised that it is upset that it didn't care for
CXXUuidofExpr, it's pretty magical compared to most expressions wrt template
arguments.</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>