[LLVMbugs] [Bug 14564] New: alignas of empty base classes gives incorrect alignment.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Dec 10 13:39:04 PST 2012


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

             Bug #: 14564
           Summary: alignas of empty base classes gives incorrect
                    alignment.
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: bigcheesegs at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


#include <iostream>

struct alignas(8) foo {

};

struct adena : foo {

};

struct alignas(8) bar {
  char a;
};

struct pie : bar {

};

int main() {
  std::cout << alignof(foo) << "\n";
  std::cout << alignof(adena) << "\n";
  std::cout << alignof(bar) << "\n";
  std::cout << alignof(pie) << "\n";
}

clang prints:
8
1
8
8

gcc (using __attribute__((aligned(8)))) prints:
8
8
8
8

-- 
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