[LLVMbugs] [Bug 7102] New: Clang fails to pack template containing packed union

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat May 8 20:06:45 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=7102

           Summary: Clang fails to pack template containing packed union
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


dhcp-172-31-154-126:~/src/llvm/clang/obj$ cat ~/tmp/test.cc
#include <stdio.h>
class NotTpl {
public:
    union {
        char space[11];
        void* ptr;
    }  __attribute__((packed));
};
template<size_t N>
class Tpl {
public:
    union {
        char space[N];
        void* ptr;
    }  __attribute__((packed));
};
int main() {
    printf("%zd\n", sizeof(NotTpl));
    printf("%zd\n", sizeof(Tpl<11>));
}
dhcp-172-31-154-126:~/src/llvm/clang/obj$ g++  ~/tmp/test.cc && ./a.out
11
11
dhcp-172-31-154-126:~/src/llvm/clang/obj$ Debug/bin/clang++  ~/tmp/test.cc &&
./a.out
11
12
dhcp-172-31-154-126:~/src/llvm/clang/obj$

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list