This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH for c++/65398 (valid constexpr rejected) (take 2)


Hi!

Just for completeness:

On Fri, Mar 20, 2015 at 09:56:52PM +0100, Marek Polacek wrote:
> +constexpr char d1 = *(&s[4] - 0); // { dg-error "array subscript out of bound" }
> +constexpr char d2 = *(&s[4] - 1);
> +constexpr char d3 = *(&s[4] - 2);
> +constexpr char d4 = *(&s[4] - 3);
> +constexpr char d5 = *(&s[4] - 4);
> +constexpr char d6 = *(&s[4] - 5);  // { dg-error "negative array subscript" }
> +
> +/* Don't accept invalid stuff.  */
> +constexpr char e1 = *(&s[5] - 1); // { dg-error "is not a constant expression" }
> +constexpr char e2 = *(&s[5] - 2); // { dg-error "is not a constant expression" }
> +constexpr char e3 = *(&s[5] - 3); // { dg-error "is not a constant expression" }
> +
> +SA (c1 == 'a');
> +SA (c2 == 'b');
> +SA (c3 == 'b');
> +SA (c4 == 'c');
> +SA (c5 == 'c');
> +SA (c6 == 'c');
> +SA (c7 == '\0');

Miss SA here for d2-d5.

> +constexpr char j1 = *(&l[4] - 0); // { dg-error "array subscript out of bound" }
> +constexpr char j2 = *(&l[4] - 1);
> +constexpr char j3 = *(&l[4] - 2);
> +constexpr char j4 = *(&l[4] - 3);
> +constexpr char j5 = *(&l[4] - 4);
> +constexpr char j6 = *(&l[4] - 5);  // { dg-error "negative array subscript" }

> +SA (i1 == 'c');
> +SA (i2 == 'd');
> +SA (i3 == 'd');
> +SA (i4 == 'e');
> +SA (i5 == 'e');
> +SA (i6 == 'e');
> +SA (i7 == '\0');

And SA here for j2-j5.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]