On 03/30/2016 09:30 AM, Jason Merrill wrote:
On 03/29/2016 11:57 PM, Martin Sebor wrote:
Are we confident that arr[0] won't make it here as POINTER_PLUS_EXPR or
some such?
I'm as confident as I can be given that this is my first time
working in this area. Which piece of code or what assumption
in particular are you concerned about?
I want to be sure that we don't fold these conditions to false.
constexpr int *ip = 0;
constexpr struct A { int ar[3]; } *ap = 0;
static_assert(&ip[0] == 0);
static_assert(&(ap->ar[0]) == 0);
I see. Thanks for clarifying. The asserts pass. The expressions
are folded earlier on (in fact, as we discussed, the second one
too early and is accepted even though it's undefined and should be
rejected in a constexpr context) and never reach fold_comparison.
Martin