diff options
author | Jason Merrill <jason@redhat.com> | 2018-04-23 16:49:38 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2018-04-23 16:49:38 -0400 |
commit | aa2b10551159df9eb1b33e049eb36ee53d379b4e (patch) | |
tree | 57df381f854d498e1870295c71d1c59e390e02d6 /gcc/cp/parser.c | |
parent | 71fbbf65fa775dfe4a3fde9f20008389f9e0e53f (diff) | |
download | gcc-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/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index bf46165f..d8ce28a 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -7993,19 +7993,22 @@ cp_parser_unary_expression (cp_parser *parser, cp_id_kind * pidk, location_t start_loc = token->location; op = keyword == RID_ALIGNOF ? ALIGNOF_EXPR : SIZEOF_EXPR; + bool std_alignof = id_equal (token->u.value, "alignof"); + /* Consume the token. */ cp_lexer_consume_token (parser->lexer); /* Parse the operand. */ operand = cp_parser_sizeof_operand (parser, keyword); if (TYPE_P (operand)) - ret = cxx_sizeof_or_alignof_type (operand, op, true); + ret = cxx_sizeof_or_alignof_type (operand, op, std_alignof, + true); else { /* ISO C++ defines alignof only with types, not with expressions. So pedwarn if alignof is used with a non- type expression. However, __alignof__ is ok. */ - if (id_equal (token->u.value, "alignof")) + if (std_alignof) pedwarn (token->location, OPT_Wpedantic, "ISO C++ does not allow %<alignof%> " "with a non-type"); |