PR c++/84463
commite885b1470015963fe962a08a4fe33f6482bd47ad
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 18 Apr 2018 06:57:45 +0000 (18 06:57 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 18 Apr 2018 06:57:45 +0000 (18 06:57 +0000)
treef9814ccf3cf6d6f69a67656064fc3303ac49c7d6
parentf5cb81c66f02133167616e56a3c492d7d2c40b7b
PR c++/84463
* typeck.c (cp_build_addr_expr_1): Move handling of offsetof-like
tricks from here to ...
* cp-gimplify.c (cp_fold) <case ADDR_EXPR>: ... here.  Only use it
if INDIRECT_REF's operand is INTEGER_CST cast to pointer type.

* g++.dg/cpp0x/constexpr-nullptr-1.C: Add -O1 to dg-options.
* g++.dg/cpp0x/constexpr-nullptr-2.C: Expect different diagnostics
in two cases.  Uncomment two other tests and add expected dg-error for
them.
* g++.dg/init/struct2.C: Cast to int rather than long to avoid
-Wnarrowing diagnostics on some targets for c++11.
* g++.dg/parse/array-size2.C: Remove xfail.
* g++.dg/cpp0x/constexpr-84463.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259458 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/cp/ChangeLog
gcc/cp/cp-gimplify.c
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/constexpr-84463.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-1.C
gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-2.C
gcc/testsuite/g++.dg/init/struct2.C
gcc/testsuite/g++.dg/parse/array-size2.C