B b;
// Verify integer literal.
- p = new char [-1]; // { dg-error "size .-1. of array is negative" }
- p = new char [2][-3]; // { dg-error "size .-3. of array|narrowing conversion" }
- p = new char [-4][5]; // { dg-error "size .-4. of array is negative" }
- p = new char [-6][-7]; // { dg-error "size .-\[67\]. of array|narrowing conversion" }
-
- p = new (p) char [-1]; // { dg-error "size .-1. of array is negative" }
- p = new (p) char [2][-3]; // { dg-error "size .-3. of array|narrowing conversion" }
- p = new (p) char [-4][5]; // { dg-error "size .-4. of array is negative" }
- p = new (p) char [-6][-7]; // { dg-error "size .-\[67\]. of array|narrowing conversion" }
-
- p = new (p) A [-1]; // { dg-error "size .-1. of array is negative" }
- p = new (p) A [2][-3]; // { dg-error "size .-3. of array|narrowing conversion" }
- p = new (p) A [-4][5]; // { dg-error "size .-4. of array is negative" }
- p = new (p) A [-6][-7]; // { dg-error "size .-\[67\]. of array|narrowing conversion" }
-
- p = new (p) B [-1]; // { dg-error "size .-1. of array is negative" }
- p = new (p) B [2][-3]; // { dg-error "size .-3. of array|narrowing conversion" }
- p = new (p) B [-4][5]; // { dg-error "size .-4. of array is negative" }
- p = new (p) B [-6][-7]; // { dg-error "size .-\[67\]. of array|narrowing conversion" }
-
- p = new (&b) B [-1]; // { dg-error "size .-1. of array is negative" }
- p = new (&b) B [2][-3]; // { dg-error "size .-3. of array|narrowing conversion" }
- p = new (&b) B [-4][5]; // { dg-error "size .-4. of array is negative" }
- p = new (&b) B [-6][-7]; // { dg-error "size .-\[67\]. of array|narrowing conversion" }
-
- p = new char [1 - 2]; // { dg-error "size .-1. of array is negative" }
- p = new (p) char [2 - 3]; // { dg-error "size .-1. of array is negative" }
- p = new A [2 < 1 ? -1 : -2]; // { dg-error "size .-2. of array is negative" }
- p = new (p) B [2 - 3 * 2]; // { dg-error "size .-4. of array is negative" }
- p = new (&b) B [1][2 - 3 * 2];// { dg-error "size .-4. of array|narrowing conversion" }
+ p = new char [-1]; // { dg-error "19:size .-1. of array is negative" }
+ p = new char [2][-3]; // { dg-error "22:size .-3. of array|narrowing conversion" }
+ p = new char [-4][5]; // { dg-error "19:size .-4. of array is negative" }
+ p = new char [-6][-7]; // { dg-error "19:size .-6. of array|narrowing conversion" }
+ // { dg-error "23:size .-7. of array" "" { target *-*-* } .-1 }
+ p = new (p) char [-1]; // { dg-error "23:size .-1. of array is negative" }
+ p = new (p) char [2][-3]; // { dg-error "26:size .-3. of array|narrowing conversion" }
+ p = new (p) char [-4][5]; // { dg-error "23:size .-4. of array is negative" }
+ p = new (p) char [-6][-7]; // { dg-error "23:size .-6. of array|narrowing conversion" }
+ // { dg-error "27:size .-7. of array" "" { target *-*-* } .-1 }
+ p = new (p) A [-1]; // { dg-error "20:size .-1. of array is negative" }
+ p = new (p) A [2][-3]; // { dg-error "23:size .-3. of array|narrowing conversion" }
+ p = new (p) A [-4][5]; // { dg-error "20:size .-4. of array is negative" }
+ p = new (p) A [-6][-7]; // { dg-error "20:size .-6. of array|narrowing conversion" }
+ // { dg-error "24:size .-7. of array" "" { target *-*-* } .-1 }
+ p = new (p) B [-1]; // { dg-error "20:size .-1. of array is negative" }
+ p = new (p) B [2][-3]; // { dg-error "23:size .-3. of array|narrowing conversion" }
+ p = new (p) B [-4][5]; // { dg-error "20:size .-4. of array is negative" }
+ p = new (p) B [-6][-7]; // { dg-error "size .-6. of array|narrowing conversion" }
+ // { dg-error "24:size .-7. of array" "" { target *-*-* } .-1 }
+ p = new (&b) B [-1]; // { dg-error "21:size .-1. of array is negative" }
+ p = new (&b) B [2][-3]; // { dg-error "24:size .-3. of array|narrowing conversion" }
+ p = new (&b) B [-4][5]; // { dg-error "21:size .-4. of array is negative" }
+ p = new (&b) B [-6][-7]; // { dg-error "21:size .-6. of array|narrowing conversion" }
+ // { dg-error "25:size .-7. of array" "" { target *-*-* } .-1 }
+ p = new char [1 - 2]; // { dg-error "21:size .-1. of array is negative" }
+ p = new (p) char [2 - 3]; // { dg-error "25:size .-1. of array is negative" }
+ p = new A [2 < 1 ? -1 : -2]; // { dg-error "22:size .-2. of array is negative" }
+ p = new (p) B [2 - 3 * 2]; // { dg-error "22:size .-4. of array is negative" }
+ p = new (&b) B [1][2 - 3 * 2];// { dg-error "26:size .-4. of array|narrowing conversion" }
}
void test_constant_expression ()
static const int i7 = -7;
// Verify constant expression.
- p = new char [i1]; // { dg-error "size .-1. of array is negative" }
- p = new char [2][i3]; // { dg-error "size .-3. of array|narrowing conversion" }
- p = new char [i4][5]; // { dg-error "size .-4. of array is negative" }
- p = new char [i6][i7]; // { dg-error "size .-\[67\]. of array|narrowing conversion" }
-
- p = new (p) char [i1]; // { dg-error "size .-1. of array is negative" }
- p = new (p) char [2][i3]; // { dg-error "size .-3. of array|narrowing conversion" }
- p = new (p) char [i4][5]; // { dg-error "size .-4. of array is negative" }
- p = new (p) char [i6][i7]; // { dg-error "size .-\[67\]. of array|narrowing conversion" }
-
- p = new (p) A [i1]; // { dg-error "size .-1. of array is negative" }
- p = new (p) A [2][i3]; // { dg-error "size .-3. of array|narrowing conversion" }
- p = new (p) A [i4][5]; // { dg-error "size .-4. of array is negative" }
- p = new (p) A [i6][i7]; // { dg-error "size .-\[67\]. of array|narrowing conversion" }
-
- p = new (p) B [i1]; // { dg-error "size .-1. of array is negative" }
- p = new (p) B [2][i3]; // { dg-error "size .-3. of array|narrowing conversion" }
- p = new (p) B [i4][5]; // { dg-error "size .-4. of array is negative" }
- p = new (p) B [i6][i7]; // { dg-error "size .-\[67\]. of array|narrowing conversion" }
-
- p = new (&b) B [i1]; // { dg-error "size .-1. of array is negative" }
- p = new (&b) B [2][i3]; // { dg-error "size .-3. of array|narrowing conversion" }
- p = new (&b) B [i4][5]; // { dg-error "size .-4. of array is negative" }
- p = new (&b) B [i6][i7]; // { dg-error "size .-\[67\]. of array|narrowing conversion" }
-
- p = new short [i1 - 2]; // { dg-error "size .-3. of array is negative" }
- p = new (p) bool [i2 - 3]; // { dg-error "size .-5. of array is negative" }
- p = new A [2 < 1 ? i1 : i2]; // { dg-error "size .-2. of array is negative" }
- p = new (p) B [2 + i3 * 2]; // { dg-error "size .-4. of array is negative" }
- p = new (&b) B [1][i1 - 3 * 2];// { dg-error "size .-7. of array|narrowing conversion" }
+ p = new char [i1]; // { dg-error "19:size .-1. of array is negative" }
+ p = new char [2][i3]; // { dg-error "22:size .-3. of array|narrowing conversion" }
+ p = new char [i4][5]; // { dg-error "19:size .-4. of array is negative" }
+ p = new char [i6][i7]; // { dg-error "19:size .-6. of array|narrowing conversion" }
+ // { dg-error "23:size .-7. of array" "" { target *-*-* } .-1 }
+ p = new (p) char [i1]; // { dg-error "23:size .-1. of array is negative" }
+ p = new (p) char [2][i3]; // { dg-error "26:size .-3. of array|narrowing conversion" }
+ p = new (p) char [i4][5]; // { dg-error "23:size .-4. of array is negative" }
+ p = new (p) char [i6][i7]; // { dg-error "23:size .-6. of array|narrowing conversion" }
+ // { dg-error "27:size .-7. of array" "" { target *-*-* } .-1 }
+ p = new (p) A [i1]; // { dg-error "20:size .-1. of array is negative" }
+ p = new (p) A [2][i3]; // { dg-error "23:size .-3. of array|narrowing conversion" }
+ p = new (p) A [i4][5]; // { dg-error "20:size .-4. of array is negative" }
+ p = new (p) A [i6][i7]; // { dg-error "20:size .-6. of array|narrowing conversion" }
+ // { dg-error "24:size .-7. of array" "" { target *-*-* } .-1 }
+ p = new (p) B [i1]; // { dg-error "20:size .-1. of array is negative" }
+ p = new (p) B [2][i3]; // { dg-error "23:size .-3. of array|narrowing conversion" }
+ p = new (p) B [i4][5]; // { dg-error "20:size .-4. of array is negative" }
+ p = new (p) B [i6][i7]; // { dg-error "20:size .-6. of array|narrowing conversion" }
+ // { dg-error "24:size .-7. of array" "" { target *-*-* } .-1 }
+ p = new (&b) B [i1]; // { dg-error "21:size .-1. of array is negative" }
+ p = new (&b) B [2][i3]; // { dg-error "24:size .-3. of array|narrowing conversion" }
+ p = new (&b) B [i4][5]; // { dg-error "21:size .-4. of array is negative" }
+ p = new (&b) B [i6][i7]; // { dg-error "21:size .-6. of array|narrowing conversion" }
+ // { dg-error "25:size .-7. of array" "" { target *-*-* } .-1 }
+ p = new short [i1 - 2]; // { dg-error "23:size .-3. of array is negative" }
+ p = new (p) bool [i2 - 3]; // { dg-error "26:size .-5. of array is negative" }
+ p = new A [2 < 1 ? i1 : i2]; // { dg-error "22:size .-2. of array is negative" }
+ p = new (p) B [2 + i3 * 2]; // { dg-error "22:size .-4. of array is negative" }
+ p = new (&b) B [1][i1 - 3 * 2];// { dg-error "27:size .-7. of array|narrowing conversion" }
}
void test_constexpr ()
#endif
// Verify constant expression.
- p = new char [s1]; // { dg-error "size .-1. of array is negative" }
- p = new char [2][s3]; // { dg-error "size .-3. of array|narrowing conversion" }
- p = new char [s4][5]; // { dg-error "size .-4. of array is negative" }
- p = new char [s6][s7]; // { dg-error "size .-\[67\]. of array|narrowing conversion" }
-
- p = new (p) char [s1]; // { dg-error "size .-1. of array is negative" }
- p = new (p) char [2][s3]; // { dg-error "size .-3. of array|narrowing conversion" }
- p = new (p) char [s4][5]; // { dg-error "size .-4. of array is negative" }
- p = new (p) char [s6][s7]; // { dg-error "size .-\[67\]. of array|narrowing conversion" }
-
- p = new (p) A [s1]; // { dg-error "size .-1. of array is negative" }
- p = new (p) A [2][s3]; // { dg-error "size .-3. of array|narrowing conversion" }
- p = new (p) A [s4][5]; // { dg-error "size .-4. of array is negative" }
- p = new (p) A [s6][s7]; // { dg-error "size .-\[67\]. of array|narrowing conversion" }
-
- p = new (p) B [s1]; // { dg-error "size .-1. of array is negative" }
- p = new (p) B [2][s3]; // { dg-error "size .-3. of array|narrowing conversion" }
- p = new (p) B [s4][5]; // { dg-error "size .-4. of array is negative" }
- p = new (p) B [s6][s7]; // { dg-error "size .-\[67\]. of array|narrowing conversion" }
-
- p = new (&b) B [s1]; // { dg-error "size .-1. of array is negative" }
- p = new (&b) B [2][s3]; // { dg-error "size .-3. of array|narrowing conversion" }
- p = new (&b) B [s4][5]; // { dg-error "size .-4. of array is negative" }
- p = new (&b) B [s6][s7]; // { dg-error "size .-\[67\]. of array|narrowing conversion" }
-
- p = new int [s1 + s2]; // { dg-error "size .-3. of array is negative" }
- p = new (p) long [2 * s3]; // { dg-error "size .-6. of array is negative" }
+ p = new char [s1]; // { dg-error "19:size .-1. of array is negative" }
+ p = new char [2][s3]; // { dg-error "22:size .-3. of array|narrowing conversion" }
+ p = new char [s4][5]; // { dg-error "19:size .-4. of array is negative" }
+ p = new char [s6][s7]; // { dg-error "19:size .-6. of array|narrowing conversion" }
+ // { dg-error "23:size .-7. of array" "" { target *-*-* } .-1 }
+ p = new (p) char [s1]; // { dg-error "23:size .-1. of array is negative" }
+ p = new (p) char [2][s3]; // { dg-error "26:size .-3. of array|narrowing conversion" }
+ p = new (p) char [s4][5]; // { dg-error "23:size .-4. of array is negative" }
+ p = new (p) char [s6][s7]; // { dg-error "23:size .-6. of array|narrowing conversion" }
+ // { dg-error "27:size .-7. of array" "" { target *-*-* } .-1 }
+ p = new (p) A [s1]; // { dg-error "20:size .-1. of array is negative" }
+ p = new (p) A [2][s3]; // { dg-error "23:size .-3. of array|narrowing conversion" }
+ p = new (p) A [s4][5]; // { dg-error "20:size .-4. of array is negative" }
+ p = new (p) A [s6][s7]; // { dg-error "20:size .-6. of array|narrowing conversion" }
+ // { dg-error "24:size .-7. of array" "" { target *-*-* } .-1 }
+ p = new (p) B [s1]; // { dg-error "20:size .-1. of array is negative" }
+ p = new (p) B [2][s3]; // { dg-error "23:size .-3. of array|narrowing conversion" }
+ p = new (p) B [s4][5]; // { dg-error "20:size .-4. of array is negative" }
+ p = new (p) B [s6][s7]; // { dg-error "20:size .-6. of array|narrowing conversion" }
+ // { dg-error "24:size .-7. of array" "" { target *-*-* } .-1 }
+ p = new (&b) B [s1]; // { dg-error "21:size .-1. of array is negative" }
+ p = new (&b) B [2][s3]; // { dg-error "24:size .-3. of array|narrowing conversion" }
+ p = new (&b) B [s4][5]; // { dg-error "21:size .-4. of array is negative" }
+ p = new (&b) B [s6][s7]; // { dg-error "21:size .-6. of array|narrowing conversion" }
+ // { dg-error "25:size .-7. of array" "" { target *-*-* } .-1 }
+ p = new int [s1 + s2]; // { dg-error "21:size .-3. of array is negative" }
+ p = new (p) long [2 * s3]; // { dg-error "25:size .-6. of array is negative" }
p = new A [s2 < s1 ? s1 : s2]; // { dg-error "size .-1. of array is negative" }
- p = new (p) B [s7 - s2 * 2]; // { dg-error "size .-3. of array is negative" }
- p = new (&b) B [9][s4 - s1 * 2]; // { dg-error "size .-2. of array|narrowing conversion" }
+ p = new (p) B [s7 - s2 * 2]; // { dg-error "23:size .-3. of array is negative" }
+ p = new (&b) B [9][s4 - s1 * 2]; // { dg-error "27:size .-2. of array|narrowing conversion" }
}
/* Prune out pedantic warnins (turned into errors via -pedantic-errors).