PR c++/68727
commitd91fe718a3750b4f2639d7a2eb75fef939ba9221
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 26 Jan 2017 19:39:40 +0000 (26 19:39 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 26 Jan 2017 19:39:40 +0000 (26 19:39 +0000)
tree156a3b12a0ead50dbb85377ac732b5a2b10a9341
parent65795d0bb3cf72428e981d39473b1cb13becbfec
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244949 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/cp/ChangeLog
gcc/cp/cp-tree.def
gcc/cp/cp-tree.h
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/offsetof8.C
gcc/testsuite/g++.dg/other/offsetof9.C [new file with mode: 0644]