===================================================================
@@ -10948,14 +10948,15 @@ grokdeclarator (const cp_declarator *declarator,
{
if (! int_n_enabled_p[declspecs->int_n_idx])
{
- error ("%<__int%d%> is not supported by this target",
- int_n_data[declspecs->int_n_idx].bitsize);
+ error_at (declspecs->locations[ds_type_spec],
+ "%<__int%d%> is not supported by this target",
+ int_n_data[declspecs->int_n_idx].bitsize);
explicit_intN = false;
}
/* Don't pedwarn if the alternate "__intN__" form has been used instead
of "__intN". */
else if (!int_n_alt && pedantic && ! in_system_header_at (input_location))
- pedwarn (input_location, OPT_Wpedantic,
+ pedwarn (declspecs->locations[ds_type_spec], OPT_Wpedantic,
"ISO C++ does not support %<__int%d%> for %qs",
int_n_data[declspecs->int_n_idx].bitsize, name);
}
@@ -11330,7 +11331,10 @@ grokdeclarator (const cp_declarator *declarator,
&& storage_class != sc_static)
|| typedef_p))
{
- error ("multiple storage classes in declaration of %qs", name);
+ location_t loc
+ = min_location (declspecs->locations[ds_thread],
+ declspecs->locations[ds_storage_class]);
+ error_at (loc, "multiple storage classes in declaration of %qs", name);
thread_p = false;
}
if (decl_context != NORMAL
@@ -11489,7 +11493,9 @@ grokdeclarator (const cp_declarator *declarator,
type = create_array_type_for_decl (dname, type,
declarator->u.array.bounds,
declarator->id_loc);
- if (!valid_array_size_p (input_location, type, dname))
+ if (!valid_array_size_p (dname
+ ? declarator->id_loc : input_location,
+ type, dname))
type = error_mark_node;
if (declarator->std_attributes)
===================================================================
@@ -298,7 +298,8 @@ finish_member_template_decl (tree decl)
return NULL_TREE;
}
else if (TREE_CODE (decl) == FIELD_DECL)
- error ("data member %qD cannot be a member template", decl);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "data member %qD cannot be a member template", decl);
else if (DECL_TEMPLATE_INFO (decl))
{
if (!DECL_TEMPLATE_SPECIALIZATION (decl))
@@ -310,7 +311,8 @@ finish_member_template_decl (tree decl)
return decl;
}
else
- error ("invalid member template declaration %qD", decl);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "invalid member template declaration %qD", decl);
return error_mark_node;
}
@@ -5515,7 +5517,8 @@ push_template_decl_real (tree decl, bool is_friend
/* [temp.mem]
A destructor shall not be a member template. */
- error ("destructor %qD declared as member template", decl);
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "destructor %qD declared as member template", decl);
return error_mark_node;
}
if (IDENTIFIER_NEWDEL_OP_P (DECL_NAME (decl))
===================================================================
@@ -3,34 +3,34 @@
#define N ((__SIZE_MAX__ / sizeof (int)) / 2 + 1)
-typedef int (*T1)[N]; /* { dg-error "exceeds maximum object size" } */
+typedef int (*T1)[N]; /* { dg-error "15:exceeds maximum object size" } */
typedef int (*T2)[N - 1];
-typedef int (*T3)[N][N]; /* { dg-error "exceeds maximum object size" } */
-typedef int (*T4)[N - 1][N - 1]; /* { dg-error "exceeds maximum object size" } */
-typedef int (**T5)[N]; /* { dg-error "exceeds maximum object size" } */
+typedef int (*T3)[N][N]; /* { dg-error "15:exceeds maximum object size" } */
+typedef int (*T4)[N - 1][N - 1]; /* { dg-error "15:exceeds maximum object size" } */
+typedef int (**T5)[N]; /* { dg-error "16:exceeds maximum object size" } */
struct S {
- int (*q1)[N]; /* { dg-error "exceeds maximum object size" } */
+ int (*q1)[N]; /* { dg-error "9:exceeds maximum object size" } */
int (*q2)[N - 1];
- int (*q3)[N][N]; /* { dg-error "exceeds maximum object size" } */
- int (*q4)[N - 1][N - 1]; /* { dg-error "exceeds maximum object size" } */
- int (**q5)[N]; /* { dg-error "exceeds maximum object size" } */
+ int (*q3)[N][N]; /* { dg-error "9:exceeds maximum object size" } */
+ int (*q4)[N - 1][N - 1]; /* { dg-error "9:exceeds maximum object size" } */
+ int (**q5)[N]; /* { dg-error "10:exceeds maximum object size" } */
};
-void fn1 (int (*p1)[N]); /* { dg-error "exceeds maximum object size" } */
+void fn1 (int (*p1)[N]); /* { dg-error "17:exceeds maximum object size" } */
void fn2 (int (*p1)[N - 1]);
-void fn3 (int (*p3)[N][N]); /* { dg-error "exceeds maximum object size" } */
-void fn4 (int (*p4)[N - 1][N - 1]); /* { dg-error "exceeds maximum object size" } */
-void fn5 (int (**p5)[N]); /* { dg-error "exceeds maximum object size" } */
+void fn3 (int (*p3)[N][N]); /* { dg-error "17:exceeds maximum object size" } */
+void fn4 (int (*p4)[N - 1][N - 1]); /* { dg-error "17:exceeds maximum object size" } */
+void fn5 (int (**p5)[N]); /* { dg-error "18:exceeds maximum object size" } */
void
fn (void)
{
- int (*n1)[N]; /* { dg-error "exceeds maximum object size" } */
+ int (*n1)[N]; /* { dg-error "9:exceeds maximum object size" } */
int (*n2)[N - 1];
- int (*n3)[N][N]; /* { dg-error "exceeds maximum object size" } */
- int (*n4)[N - 1][N - 1]; /* { dg-error "exceeds maximum object size" } */
- int (**n5)[N]; /* { dg-error "exceeds maximum object size" } */
+ int (*n3)[N][N]; /* { dg-error "9:exceeds maximum object size" } */
+ int (*n4)[N - 1][N - 1]; /* { dg-error "9:exceeds maximum object size" } */
+ int (**n5)[N]; /* { dg-error "10:exceeds maximum object size" } */
sizeof (int (*)[N]); /* { dg-error "exceeds maximum object size" } */
sizeof (int [N]); /* { dg-error "exceeds maximum object size" } */
===================================================================
@@ -0,0 +1,5 @@
+// { dg-do compile { target int128 } }
+
+__int128 i __attribute__((unused)); // { dg-error "1:ISO C\\+\\+ does not support" }
+
+unsigned __int128 ui __attribute__((unused)); // { dg-error "10:ISO C\\+\\+ does not support" }
===================================================================
@@ -20,7 +20,7 @@ sub (int *a)
int
main (void)
{
- int a[DIM][DIM]; /* { dg-error "exceeds maximum object size" } */
+ int a[DIM][DIM]; /* { dg-error "7:exceeds maximum object size" } */
return sub (&a[0][0]); /* { dg-error "declared" } */
}
===================================================================
@@ -1,7 +1,7 @@
struct Foo
{
template <int i>
- ~Foo() {} // { dg-error "" }
+ ~Foo() {} // { dg-error "5:destructor .Foo::~Foo\\\(\\\)." }
};
int main()
===================================================================
@@ -3,5 +3,5 @@
struct Foo
{
template <int i>
- ~Foo(); // { dg-error "" }
+ ~Foo(); // { dg-error "5:destructor .Foo::~Foo\\\(\\\)." }
};
===================================================================
@@ -4,14 +4,14 @@
__thread extern int g1; /* { dg-error "'__thread' before 'extern'" } */
__thread static int g2; /* { dg-error "'__thread' before 'static'" } */
__thread __thread int g3; /* { dg-error "duplicate '__thread'" } */
-typedef __thread int g4; /* { dg-error "multiple storage classes" } */
+typedef __thread int g4; /* { dg-error "9:multiple storage classes" } */
void foo()
{
__thread int l1; /* { dg-error "3:function-scope .l1. implicitly auto and declared '__thread'" } */
- auto __thread int l2; /* { dg-error "multiple storage classes|data types" } */
+ auto __thread int l2; /* { dg-error "3:multiple storage classes|data types" } */
__thread extern int l3; /* { dg-error "'__thread' before 'extern'" } */
- register __thread int l4; /* { dg-error "multiple storage classes" } */
+ register __thread int l4; /* { dg-error "3:multiple storage classes" } */
} /* { dg-error "ISO C\\+\\+17 does not allow 'register' storage class specifier" "" { target c++17 } .-1 } */
__thread void f1 (); /* { dg-error "1:storage class .__thread. invalid for function" } */
===================================================================
@@ -1,10 +1,10 @@
/* Invalid __thread specifiers. */
/* { dg-require-effective-target tls } */
-__thread typedef int g4; /* { dg-error "multiple storage classes" } */
+__thread typedef int g4; /* { dg-error "1:multiple storage classes" } */
void foo()
{
- __thread auto int l2; /* { dg-error "multiple storage classes|data types" } */
- __thread register int l4; /* { dg-error "multiple storage classes" } */
+ __thread auto int l2; /* { dg-error "3:multiple storage classes|data types" } */
+ __thread register int l4; /* { dg-error "3:multiple storage classes" } */
} /* { dg-error "ISO C\\+\\+17 does not allow 'register' storage class specifier" "" { target c++17 } .-1 } */
===================================================================
@@ -2,4 +2,4 @@
// Invalid __thread specifiers.
// { dg-require-effective-target tls }
-struct A { __thread register int i; }; // { dg-error "multiple storage classes|storage class specified" }
+struct A { __thread register int i; }; // { dg-error "12:multiple storage classes|storage class specified" }
===================================================================
@@ -2,5 +2,5 @@
class A
{
- template<class T>T epsilon; // { dg-error "" } invalid member template
+ template<class T>T epsilon; // { dg-error "22:data member .epsilon. cannot be a member template" }
};