aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-04-23 16:49:38 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-04-23 16:49:38 -0400
commitaa2b10551159df9eb1b33e049eb36ee53d379b4e (patch)
tree57df381f854d498e1870295c71d1c59e390e02d6 /gcc/cp/pt.c
parent71fbbf65fa775dfe4a3fde9f20008389f9e0e53f (diff)
downloadgcc-aa2b10551159df9eb1b33e049eb36ee53d379b4e.zip
gcc-aa2b10551159df9eb1b33e049eb36ee53d379b4e.tar.gz
gcc-aa2b10551159df9eb1b33e049eb36ee53d379b4e.tar.bz2
PR c++/69560 - wrong alignof(double) on x86.
CWG 1879 - Inadequate definition of alignment requirement. * cp-tree.h (ALIGNOF_EXPR_STD_P): New. * typeck.c (cxx_sizeof_or_alignof_type): Add std_alignof parm. (cxx_sizeof_expr, cxx_sizeof_nowarn, cxx_alignas_expr) (cxx_alignof_expr): Pass it. * parser.c (cp_parser_unary_expression): Pass it. * pt.c (tsubst_copy): Copy it. (tsubst_copy_and_build): Pass it. * decl.c (fold_sizeof_expr): Pass it. From-SVN: r259578
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index e2a12b9..9fb8197 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -15598,7 +15598,8 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
expanded = make_argument_pack (expanded);
if (TYPE_P (expanded))
- return cxx_sizeof_or_alignof_type (expanded, SIZEOF_EXPR,
+ return cxx_sizeof_or_alignof_type (expanded, SIZEOF_EXPR,
+ false,
complain & tf_error);
else
return cxx_sizeof_or_alignof_expr (expanded, SIZEOF_EXPR,
@@ -15636,7 +15637,10 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
{
tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
tree op0 = tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl);
- return build1 (code, type, op0);
+ r = build1 (code, type, op0);
+ if (code == ALIGNOF_EXPR)
+ ALIGNOF_EXPR_STD_P (r) = ALIGNOF_EXPR_STD_P (t);
+ return r;
}
case COMPONENT_REF:
@@ -18002,6 +18006,8 @@ tsubst_copy_and_build (tree t,
op1 = TREE_OPERAND (t, 0);
if (TREE_CODE (t) == SIZEOF_EXPR && SIZEOF_EXPR_TYPE_P (t))
op1 = TREE_TYPE (op1);
+ bool std_alignof = (TREE_CODE (t) == ALIGNOF_EXPR
+ && ALIGNOF_EXPR_STD_P (t));
if (!args)
{
/* When there are no ARGS, we are trying to evaluate a
@@ -18025,7 +18031,7 @@ tsubst_copy_and_build (tree t,
--c_inhibit_evaluation_warnings;
}
if (TYPE_P (op1))
- r = cxx_sizeof_or_alignof_type (op1, TREE_CODE (t),
+ r = cxx_sizeof_or_alignof_type (op1, TREE_CODE (t), std_alignof,
complain & tf_error);
else
r = cxx_sizeof_or_alignof_expr (op1, TREE_CODE (t),