+2018-10-30 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * decl.c (grokdeclarator): Use declarator->id_loc in diagnostic
+ about flexible array members.
+
2018-10-29 David Malcolm <dmalcolm@redhat.com>
* cp-name-hint.h: New file.
/* Do not warn on flexible array members in system
headers because glibc uses them. */;
else if (name)
- pedwarn (input_location, OPT_Wpedantic,
+ pedwarn (declarator->id_loc, OPT_Wpedantic,
"ISO C++ forbids flexible array member %qs", name);
else
pedwarn (input_location, OPT_Wpedantic,
+2018-10-30 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * g++.dg/cpp1z/has-unique-obj-representations1.C: Test location too.
+ * g++.dg/ext/flexarray-mangle-2.C: Likewise.
+ * g++.dg/ext/flexarray-mangle.C: Likewise.
+ * g++.dg/ext/flexarray-subst.C: Likewise.
+ * g++.dg/ext/flexary10.C: Likewise.
+ * g++.dg/ext/flexary11.C: Likewise.
+ * g++.dg/ext/flexary14.C: Likewise.
+ * g++.dg/ext/flexary16.C: Likewise.
+ * g++.dg/ext/flexary26.C: Likewise.
+ * g++.dg/ext/flexary27.C: Likewise.
+ * g++.dg/ext/flexary7.C: Likewise.
+ * g++.dg/ext/pr71290.C: Likewise.
+
2018-10-30 Paul Koning <ni1d@arrl.net>
* gcc.dg/tree-ssa/attr-alias.c: Skip if no weak support.
struct W {};
struct X : public W { int i; void bar (); };
struct Y {
- char a[3]; char b[]; // { dg-warning "forbids flexible array member" }
+ char a[3]; char b[]; // { dg-warning "19:ISO C\\+\\+ forbids flexible array member" }
};
struct Z { int a; float b; };
struct A { int i : INTB * 2; int j; }; // { dg-warning "exceeds its type" }
struct A {
int n;
- char a[]; // { dg-warning "forbids flexible array member" }
+ char a[]; // { dg-warning "8:ISO C\\+\\+ forbids flexible array member" }
};
// Declare but do not define function templates.
struct A {
int n;
- char a[]; // { dg-warning "forbids flexible array member" }
+ char a[]; // { dg-warning "8:ISO C\\+\\+ forbids flexible array member" }
};
// Declare but do not define function templates.
struct A {
int n;
- char a[]; // { dg-warning "forbids flexible array member" }
+ char a[]; // { dg-warning "8:ISO C\\+\\+ forbids flexible array member" }
};
template <class>
struct A {
int n;
- int a[]; // { dg-warning "forbids flexible array member" }
+ int a[]; // { dg-warning "7:ISO C\\+\\+ forbids flexible array member" }
};
struct A foo (void)
struct A {
int n;
- char a[]; // { dg-error "forbids flexible array member" }
+ char a[]; // { dg-error "8:ISO C\\+\\+ forbids flexible array member" }
};
void f ()
template <class T> int foo (T&, typename A<T>::X = 0) { return 0; }
struct B {
- int n, a[]; // { dg-error "forbids flexible array member" }
+ int n, a[]; // { dg-error "10:ISO C\\+\\+ forbids flexible array member" }
};
void bar (B *b)
struct incomplete {
int x;
- elem array[]; // { dg-warning "forbids flexible array member" }
+ elem array[]; // { dg-warning "10:ISO C\\+\\+ forbids flexible array member" }
};
};
{
struct S {
int x;
- typename container<T>::elem array[]; // { dg-warning "forbids flexible array member" }
+ typename container<T>::elem array[]; // { dg-warning "33:ISO C\\+\\+ forbids flexible array member" }
};
};
// { dg-do compile }
// { dg-options "-Wpedantic" }
-struct S { const char *a; char b[]; }; // { dg-warning "forbids flexible array member" }
-struct T { int a; int b[]; }; // { dg-warning "forbids flexible array member" }
+struct S { const char *a; char b[]; }; // { dg-warning "32:ISO C\\+\\+ forbids flexible array member" }
+struct T { int a; int b[]; }; // { dg-warning "23:ISO C\\+\\+ forbids flexible array member" }
#if __cplusplus >= 201103L
S c[] { "", "" }; // { dg-error "initialization of flexible array member in a nested context" "" { target c++11 } }
// { dg-warning "initialization of a flexible array member" "" { target c++11 } .-1 }
// PR c++/81922
// { dg-do compile }
-struct S { const char *a; char b[]; }; // { dg-error "forbids flexible array member" }
-struct T { int a; int b[]; }; // { dg-error "forbids flexible array member" }
+struct S { const char *a; char b[]; }; // { dg-error "32:ISO C\\+\\+ forbids flexible array member" }
+struct T { int a; int b[]; }; // { dg-error "23:ISO C\\+\\+ forbids flexible array member" }
#if __cplusplus >= 201103L
S c[] { "", "" }; // { dg-error "initialization of flexible array member in a nested context" "" { target c++11 } }
// { dg-error "initialization of a flexible array member" "" { target c++11 } .-1 }
struct FlexChar {
int n;
- char a[]; // { dg-warning "forbids flexible array member" }
+ char a[]; // { dg-warning "10:ISO C\\+\\+ forbids flexible array member" }
};
struct FlexChar ac =
struct FlexWchar {
int n;
- wchar_t a[]; // { dg-warning "forbids flexible array member" }
+ wchar_t a[]; // { dg-warning "13:ISO C\\+\\+ forbids flexible array member" }
};
struct FlexWchar awc =
struct FlexInt {
int n;
- int a[]; // { dg-warning "forbids flexible array member" }
+ int a[]; // { dg-warning "9:ISO C\\+\\+ forbids flexible array member" }
};
// Verify that no warning is issued for the case when a flexible array
template <class T>
struct FlexT {
int n;
- T a[]; // { dg-warning "forbids flexible array member" }
+ T a[]; // { dg-warning "7:ISO C\\+\\+ forbids flexible array member" }
};
struct FlexT<char> atc =
// PR c++/71290 - [6/7 Regression] Flexible array member is not diagnosed
// with -pedantic
-// { dg-do compile }s
+// { dg-do compile }
// { dg-options "-Wall -Wpedantic" }
struct A
{
int i;
- int arr[]; // { dg-warning "forbids flexible array member .arr." }
+ int arr[]; // { dg-warning "7:ISO C\\+\\+ forbids flexible array member .arr." }
};
template <class T>
struct B {
T n;
- T a[]; // { dg-warning "forbids flexible array member .a." }
+ T a[]; // { dg-warning "5:ISO C\\+\\+ forbids flexible array member .a." }
};