[llvm-bugs] [Bug 39713] New: std::alignment_of<T>::value might be different from alignof(T)

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 19 13:54:03 PST 2018


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

            Bug ID: 39713
           Summary: std::alignment_of<T>::value might be different from
                    alignof(T)
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sbenza at google.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

Simple repro:

#include <type_traits>
static_assert(alignof(long long) == std::alignment_of<long long>::value);

With compiler flags: -std=c++17 -m32 -stdlib=libc++

alignof(long long) == 4
std::alignment_of<long long>::value == 8

The problem is that std::alignment_of is using __alignof__ which gives a
different result than alignof in this particular case.

-- 
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/20181119/b88062e6/attachment.html>


More information about the llvm-bugs mailing list