[Bug c++/88115] Incorrect result from alignof in templates, if also using __alignof__.
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Apr 21 12:08:14 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88115
--- Comment #13 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:a34c19926b87f9cadd5ea84f5c5b93ae76b14558
commit r8-10855-ga34c19926b87f9cadd5ea84f5c5b93ae76b14558
Author: Patrick Palka <ppalka@redhat.com>
Date: Wed Oct 7 10:49:00 2020 -0400
c++: Distinguish alignof and __alignof__ in cp_tree_equal [PR97273]
cp_tree_equal currently considers alignof the same as __alignof__, but
these operators are semantically different ever since r8-7957. In the
testcase below, this causes the second static_assert to fail on targets
where alignof(double) != __alignof__(double) because the specialization
table (which uses cp_tree_equal as its equality predicate) conflates the
two dependent specializations integral_constant<__alignof__(T)> and
integral_constant<alignof(T)>.
This patch makes cp_tree_equal distinguish between these two operators
by inspecting the ALIGNOF_EXPR_STD_P flag.
gcc/cp/ChangeLog:
PR c++/88115
PR libstdc++/97273
* tree.c (cp_tree_equal) <case ALIGNOF_EXPR>: Return false if
ALIGNOF_EXPR_STD_P differ.
gcc/testsuite/ChangeLog:
PR c++/88115
PR libstdc++/97273
* g++.dg/template/alignof3.C: New test.
(cherry picked from commit 592fe221735bdaa375b1834dd49ce125d0b600d8)
More information about the Gcc-bugs
mailing list