<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 --- - Importing from external layout broken for template specializations"
   href="https://llvm.org/bugs/show_bug.cgi?id=25015">25015</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Importing from external layout broken for template specializations
          </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>Windows NT
          </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>david.majnemer@gmail.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>zturner@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>template<bool b>
struct Foo
{
    virtual ~Foo() {}
    int Member;
};

template<>
struct Foo<false>
{
    int Member;
};

int main(int argc, char **argv)
{
    Foo<true> *f1 = new Foo<true>();
    Foo<false> *f2 = new Foo<false>();
    return 0;
}

$ clang++ -Xclang -fdump-record-layouts-simple -c foo.cpp > foo.layouts
$ clang++ -Xclang -fdump-record-layouts-simple -Xclang
-foverride-record-layout=foo.layouts foo.cpp

Assertion failed: Prior->Kind == MemberInfo::Field && !Prior->FD && "Only
storage fields have tail padding!", file
D:\src\llvm\tools\clang\lib\CodeGen\CGRecordLayoutBuilder.cpp, line 557
0x016D5709 (0x00000016 0x32AEDEFF 0x0683C5E8 0x0683C578), HandleAbort() + 0x9
bytes(s), d:\src\llvm\lib\support\windows\signals.inc, line 296
0x0FAFF7F9 (0x00000016 0x016D5700 0x0683C564 0x0FAF9AC4), raise() + 0x2B9
bytes(s)
0x0FB0B284 (0x0683C5E8 0x0683C578 0x000000BB 0xCCCCCCCC), abort() + 0x34
bytes(s)
0x0FAF9AC4 (0x054EAD30 0x054EAC90 0x0000022D 0x0683C640), _wassert() + 0xD4
bytes(s)
0x01BE6159 (0x0683C900 0x0683C618 0x00000004 0x00000000), `anonymous
namespace'::CGRecordLowering::clipTailPadding() + 0xF9 bytes(s),
d:\src\llvm\tools\clang\lib\codegen\cgrecordlayoutbuilder.cpp, line 557 + 0x3C
byte(s)
0x01BE4C3F (0x00000000 0x0683C978 0x0683D0AC 0xCCCCCCCC), `anonymous
namespace'::CGRecordLowering::lower() + 0x12F bytes(s),
d:\src\llvm\tools\clang\lib\codegen\cgrecordlayoutbuilder.cpp, line 279
0x01BE3F4E (0x06B22FD0 0x06B25668 0x0683CB1C 0x0683D0AC),
clang::CodeGen::CodeGenTypes::ComputeRecordLayout() + 0x4E bytes(s),
d:\src\llvm\tools\clang\lib\codegen\cgrecordlayoutbuilder.cpp, line 692
0x01A2B8B8 (0x06B22FD0 0x0683CCD4 0x0683D0AC 0xCCCCCCCC),
clang::CodeGen::CodeGenTypes::ConvertRecordDeclType() + 0x1E8 bytes(s),
d:\src\llvm\tools\clang\lib\codegen\codegentypes.cpp, line 685 + 0x10 byte(s)
0x01A2A380 (0x06B23080 0xCCCCCCCC 0x06B24580 0x0683CCD4),
clang::CodeGen::CodeGenTypes::ConvertType() + 0x80 bytes(s),
d:\src\llvm\tools\clang\lib\codegen\codegentypes.cpp, line 305 + 0x11 byte(s)
0x01A2B103 (0x06B23080 0x0683CEB4 0x0683D0AC 0xCCCCCCCC),
clang::CodeGen::CodeGenTypes::ConvertTypeForMem() + 0x23 bytes(s),
d:\src\llvm\tools\clang\lib\codegen\codegentypes.cpp, line 84 + 0xC byte(s)
0x01A2A6A4 (0x06B230F0 0xCCCCCCCC 0x06B24580 0x0683CCF8),
clang::CodeGen::CodeGenTypes::ConvertType() + 0x3A4 bytes(s),
d:\src\llvm\tools\clang\lib\codegen\codegentypes.cpp, line 435 + 0xC byte(s)
0x01A2B103 (0x06B23110 0x0683D1FC 0x0683CEB4 0x01AFF1B3),
clang::CodeGen::CodeGenTypes::ConvertTypeForMem() + 0x23 bytes(s),
d:\src\llvm\tools\clang\lib\codegen\codegentypes.cpp, line 84 + 0xC byte(s)
0x01ADA1C4 (0x06B23110 0x0683CEFC 0x0683D0AC 0x00000000),
clang::CodeGen::CodeGenFunction::ConvertTypeForMem() + 0x24 bytes(s),
d:\src\llvm\tools\clang\lib\codegen\codegenfunction.cpp, line 163
0x01AFF1B3 (0x0683CECC 0x06B23150 0x0683CF54 0xCCCCCCCC),
clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca() + 0x403 bytes(s),
d:\src\llvm\tools\clang\lib\codegen\cgdecl.cpp, line 967 + 0xC byte(s)

Problem only happens when specializating a template (fully or partially) and
also requires a virtual function in one of the specializations.  The output of
`foo.layouts` looks normal, so the problem seems to be unrelated to the layout
algorithm itself, and more to do with reading the layout algorithm in from a
dump.</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>