[PATCH] PR libstdc++/88119 use alignof in std::alignment_of, not __alignof__

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] PR libstdc++/88119 use alignof in std::alignment_of, not __alignof__

Jonathan Wakely-3
Now that __alignof__ and alignof sometimes disagree it matters which one
we use. The standard says that std::alignment_of<T>::value equals
alignof(T), so we need to use that.

Change the only uses of alignment_of to use __alignof__ to avoid a
change in alignment.

        PR libstdc++/88119
        * include/ext/aligned_buffer.h (__aligned_membuf): Add comment.
        (__aligned_buffer): Use __alignof__ instead of std::alignment_of.
        * include/std/type_traits (alignment_of): Use alignof instead of
        __alignof__.
        * testsuite/20_util/alignment_of/value.cc: Fix test to check values
        match alignof not __alignof__, as required by the standard.

Tested powercp64le-linux, committed to trunk.

This should be changed on gcc-8-branch too.



patch.txt (4K) Download Attachment