[Bug c++/68727] [5/6/7 regression] invalid offsetof expressions accepted
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jan 26 19:40:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68727
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Thu Jan 26 19:39:40 2017
New Revision: 244949
URL: https://gcc.gnu.org/viewcvs?rev=244949&root=gcc&view=rev
Log:
PR c++/68727
* cp-tree.def (OFFSETOF_EXPR): Bump number of operands to 2.
* cp-tree.h (finish_offsetof): Add OBJECT_PTR argument.
* parser.c (cp_parser_builtin_offsetof): Pass result of
build_static_cast of null_pointer_node to finish_offsetof.
* semantics.c (finish_offsetof): Add OBJECT_PTR argument, use
it for -Winvalid-offsetof pedwarn instead of trying to guess
original offsetof type from EXPR. Save OBJECT_PTR as a new
second operand to OFFSETOF_EXPR.
* pt.c (tsubst_copy_and_build) <case OFFSETOF_EXPR>: Adjust
finish_offsetof caller, pass the second operand of OFFSETOF_EXPR
as OBJECT_PTR.
* g++.dg/other/offsetof8.C: Add expected error.
* g++.dg/other/offsetof9.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/other/offsetof9.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-tree.def
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/parser.c
trunk/gcc/cp/pt.c
trunk/gcc/cp/semantics.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/other/offsetof8.C
More information about the Gcc-bugs
mailing list