On Tue, Jan 24, 2017 at 07:01:45AM -0500, Nathan Sidwell wrote:
> On 01/24/2017 05:49 AM, Jakub Jelinek wrote:
> 
> > ((BIT_FIELD_REF <a, 8, 0> ^ BIT_FIELD_REF <b, 8, 0>) & 110) == 0
> > out of that.  So unless we DTRT (i.e. save constexpr bodies before
> > cp_fold for constexpr evaluation purposes), the workaround would need
> > to handle this properly (basically pattern recognize whatever the
> 
> for avoidance of doubt, I'm arguing that such folding is premature in the
> face of contexpr.

I'm arguing that pretty much all folding is premature in the face of
constexpr.  We e.g. accept:

constexpr int a[2] = { 1, 2 };
constexpr int foo (const int *x, int y) { return x[y] & 0; }
constexpr int b = foo (a, 1);
constexpr int c = foo (a, 2);           // { dg-error "" }
constexpr int d = foo (a, 3);           // { dg-error "" }

because we do constexpr evaluation on folded trees, while clang++ properly
rejects it for c and d.

        Jakub

Reply via email to