Commit 23644e8c by Paolo Carlini Committed by Paolo Carlini

decl.c (duplicate_decls): Replace pairs of errors and permerrors with error +…

decl.c (duplicate_decls): Replace pairs of errors and permerrors with error + inform (permerror + inform...

/cp
2013-12-05  Paolo Carlini  <paolo.carlini@oracle.com>

	* decl.c (duplicate_decls): Replace pairs of errors and permerrors
	with error + inform (permerror + inform, respectively).

/testsuite
2013-12-05  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/cpp0x/constexpr-46336.C: Adjust expected messages.
	* g++.dg/cpp0x/defaulted2.C: Likewise.
	* g++.dg/cpp1y/auto-fn8.C: Likewise.
	* g++.dg/gomp/udr-3.C: Likewise.
	* g++.dg/lookup/extern-c-redecl5.C: Likewise.
	* g++.dg/lookup/linkage1.C: Likewise.
	* g++.dg/overload/new1.C: Likewise.
	* g++.dg/parse/friend5.C: Likewise.
	* g++.dg/parse/namespace-alias-1.C: Likewise.
	* g++.dg/parse/namespace10.C: Likewise.
	* g++.dg/parse/redef2.C: Likewise.
	* g++.dg/template/friend44.C: Likewise.
	* g++.old-deja/g++.brendan/crash42.C: Likewise.
	* g++.old-deja/g++.brendan/crash52.C: Likewise.
	* g++.old-deja/g++.brendan/crash55.C: Likewise.
	* g++.old-deja/g++.jason/overload21.C: Likewise.
	* g++.old-deja/g++.jason/overload5.C: Likewise.
	* g++.old-deja/g++.jason/redecl1.C: Likewise.
	* g++.old-deja/g++.law/arm8.C: Likewise.
	* g++.old-deja/g++.other/main1.C: Likewise.

From-SVN: r205697
parent fd9cf409
2013-12-05 Paolo Carlini <paolo.carlini@oracle.com>
* decl.c (duplicate_decls): Replace pairs of errors and permerrors
with error + inform (permerror + inform, respectively).
2013-12-04 Joseph Myers <joseph@codesourcery.com> 2013-12-04 Joseph Myers <joseph@codesourcery.com>
PR c/52023 PR c/52023
......
...@@ -1299,8 +1299,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1299,8 +1299,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
{ {
if (warning (OPT_Wattributes, "function %q+D redeclared as inline", if (warning (OPT_Wattributes, "function %q+D redeclared as inline",
newdecl)) newdecl))
inform (input_location, "previous declaration of %q+D " inform (DECL_SOURCE_LOCATION (olddecl),
"with attribute noinline", olddecl); "previous declaration of %qD with attribute noinline",
olddecl);
} }
else if (DECL_DECLARED_INLINE_P (olddecl) else if (DECL_DECLARED_INLINE_P (olddecl)
&& DECL_UNINLINABLE (newdecl) && DECL_UNINLINABLE (newdecl)
...@@ -1308,7 +1309,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1308,7 +1309,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
{ {
if (warning (OPT_Wattributes, "function %q+D redeclared with " if (warning (OPT_Wattributes, "function %q+D redeclared with "
"attribute noinline", newdecl)) "attribute noinline", newdecl))
inform (input_location, "previous declaration of %q+D was inline", inform (DECL_SOURCE_LOCATION (olddecl),
"previous declaration of %qD was inline",
olddecl); olddecl);
} }
} }
...@@ -1343,11 +1345,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1343,11 +1345,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
warning (0, "library function %q#D redeclared as non-function %q#D", warning (0, "library function %q#D redeclared as non-function %q#D",
olddecl, newdecl); olddecl, newdecl);
else else
{ error ("declaration of %q#D conflicts with built-in "
error ("declaration of %q#D", newdecl); "declaration %q#D", newdecl, olddecl);
error ("conflicts with built-in declaration %q#D",
olddecl);
}
return NULL_TREE; return NULL_TREE;
} }
else if (DECL_OMP_DECLARE_REDUCTION_P (olddecl)) else if (DECL_OMP_DECLARE_REDUCTION_P (olddecl))
...@@ -1355,7 +1354,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1355,7 +1354,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
gcc_assert (DECL_OMP_DECLARE_REDUCTION_P (newdecl)); gcc_assert (DECL_OMP_DECLARE_REDUCTION_P (newdecl));
error_at (DECL_SOURCE_LOCATION (newdecl), error_at (DECL_SOURCE_LOCATION (newdecl),
"redeclaration of %<pragma omp declare reduction%>"); "redeclaration of %<pragma omp declare reduction%>");
error_at (DECL_SOURCE_LOCATION (olddecl), inform (DECL_SOURCE_LOCATION (olddecl),
"previous %<pragma omp declare reduction%> declaration"); "previous %<pragma omp declare reduction%> declaration");
return error_mark_node; return error_mark_node;
} }
...@@ -1407,11 +1406,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1407,11 +1406,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
/* A near match; override the builtin. */ /* A near match; override the builtin. */
if (TREE_PUBLIC (newdecl)) if (TREE_PUBLIC (newdecl))
{ warning (0, "new declaration %q#D ambiguates built-in "
warning (0, "new declaration %q#D", newdecl); "declaration %q#D", newdecl, olddecl);
warning (0, "ambiguates built-in declaration %q#D",
olddecl);
}
else else
warning (OPT_Wshadow, warning (OPT_Wshadow,
DECL_BUILT_IN (olddecl) DECL_BUILT_IN (olddecl)
...@@ -1504,7 +1500,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1504,7 +1500,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
error ("%q#D redeclared as different kind of symbol", newdecl); error ("%q#D redeclared as different kind of symbol", newdecl);
if (TREE_CODE (olddecl) == TREE_LIST) if (TREE_CODE (olddecl) == TREE_LIST)
olddecl = TREE_VALUE (olddecl); olddecl = TREE_VALUE (olddecl);
inform (input_location, "previous declaration of %q+#D", olddecl); inform (DECL_SOURCE_LOCATION (olddecl),
"previous declaration %q#D", olddecl);
return error_mark_node; return error_mark_node;
} }
...@@ -1523,8 +1520,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1523,8 +1520,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == TYPE_DECL if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == TYPE_DECL
|| TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL) || TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL)
{ {
error ("declaration of template %q#D", newdecl); error ("conflicting declaration of template %q#D", newdecl);
error ("conflicts with previous declaration %q+#D", olddecl); inform (DECL_SOURCE_LOCATION (olddecl),
"previous declaration %q#D", olddecl);
return error_mark_node; return error_mark_node;
} }
else if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == FUNCTION_DECL else if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == FUNCTION_DECL
...@@ -1538,8 +1536,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1538,8 +1536,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
&& same_type_p (TREE_TYPE (TREE_TYPE (newdecl)), && same_type_p (TREE_TYPE (TREE_TYPE (newdecl)),
TREE_TYPE (TREE_TYPE (olddecl)))) TREE_TYPE (TREE_TYPE (olddecl))))
{ {
error ("new declaration %q#D", newdecl); error ("ambiguating new declaration %q#D", newdecl);
error ("ambiguates old declaration %q+#D", olddecl); inform (DECL_SOURCE_LOCATION (olddecl),
"old declaration %q#D", olddecl);
} }
return NULL_TREE; return NULL_TREE;
} }
...@@ -1547,9 +1546,10 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1547,9 +1546,10 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
{ {
if (DECL_EXTERN_C_P (newdecl) && DECL_EXTERN_C_P (olddecl)) if (DECL_EXTERN_C_P (newdecl) && DECL_EXTERN_C_P (olddecl))
{ {
error ("declaration of C function %q#D conflicts with", error ("conflicting declaration of C function %q#D",
newdecl); newdecl);
error ("previous declaration %q+#D here", olddecl); inform (DECL_SOURCE_LOCATION (olddecl),
"previous declaration %q#D", olddecl);
return NULL_TREE; return NULL_TREE;
} }
/* For function versions, params and types match, but they /* For function versions, params and types match, but they
...@@ -1559,8 +1559,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1559,8 +1559,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
&& compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)), && compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)),
TYPE_ARG_TYPES (TREE_TYPE (olddecl)))) TYPE_ARG_TYPES (TREE_TYPE (olddecl))))
{ {
error ("new declaration %q#D", newdecl); error ("ambiguating new declaration of %q#D", newdecl);
error ("ambiguates old declaration %q+#D", olddecl); inform (DECL_SOURCE_LOCATION (olddecl),
"old declaration %q#D", olddecl);
return error_mark_node; return error_mark_node;
} }
else else
...@@ -1569,8 +1570,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1569,8 +1570,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
else else
{ {
error ("conflicting declaration %q#D", newdecl); error ("conflicting declaration %q#D", newdecl);
inform (input_location, inform (DECL_SOURCE_LOCATION (olddecl),
"%q+D has a previous declaration as %q#D", olddecl, olddecl); "previous declaration as %q#D", olddecl);
return error_mark_node; return error_mark_node;
} }
} }
...@@ -1622,8 +1623,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1622,8 +1623,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
A namespace-name defined at global scope shall not be A namespace-name defined at global scope shall not be
declared as the name of any other entity in any global scope declared as the name of any other entity in any global scope
of the program. */ of the program. */
error ("declaration of namespace %qD conflicts with", newdecl); error ("conflicting declaration of namespace %qD", newdecl);
error ("previous declaration of namespace %q+D here", olddecl); inform (DECL_SOURCE_LOCATION (olddecl),
"previous declaration of namespace %qD here", olddecl);
return error_mark_node; return error_mark_node;
} }
else else
...@@ -1645,9 +1647,10 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1645,9 +1647,10 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
&& prototype_p (TREE_TYPE (newdecl))) && prototype_p (TREE_TYPE (newdecl)))
{ {
/* Prototype decl follows defn w/o prototype. */ /* Prototype decl follows defn w/o prototype. */
warning_at (input_location, 0, "prototype for %q+#D", newdecl); warning_at (DECL_SOURCE_LOCATION (newdecl), 0,
warning_at (DECL_SOURCE_LOCATION (olddecl), 0, "prototype specified for %q#D", newdecl);
"follows non-prototype definition here"); inform (DECL_SOURCE_LOCATION (olddecl),
"previous non-prototype definition here");
} }
else if (VAR_OR_FUNCTION_DECL_P (olddecl) else if (VAR_OR_FUNCTION_DECL_P (olddecl)
&& DECL_LANGUAGE (newdecl) != DECL_LANGUAGE (olddecl)) && DECL_LANGUAGE (newdecl) != DECL_LANGUAGE (olddecl))
...@@ -1686,10 +1689,11 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1686,10 +1689,11 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
} }
else else
{ {
error ("previous declaration of %q+#D with %qL linkage", error ("conflicting declaration of %q#D with %qL linkage",
olddecl, DECL_LANGUAGE (olddecl)); newdecl, DECL_LANGUAGE (newdecl));
error ("conflicts with new declaration with %qL linkage", inform (DECL_SOURCE_LOCATION (olddecl),
DECL_LANGUAGE (newdecl)); "previous declaration with %qL linkage",
DECL_LANGUAGE (olddecl));
} }
} }
...@@ -1729,18 +1733,19 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1729,18 +1733,19 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
if (1 == simple_cst_equal (TREE_PURPOSE (t1), if (1 == simple_cst_equal (TREE_PURPOSE (t1),
TREE_PURPOSE (t2))) TREE_PURPOSE (t2)))
{ {
permerror (input_location, if (permerror (input_location,
"default argument given for parameter %d " "default argument given for parameter "
"of %q#D", i, newdecl); "%d of %q#D", i, newdecl))
permerror (input_location, permerror (DECL_SOURCE_LOCATION (olddecl),
"after previous specification in %q+#D", "previous specification in %q#D here",
olddecl); olddecl);
} }
else else
{ {
error ("default argument given for parameter %d " error ("default argument given for parameter %d "
"of %q#D", i, newdecl); "of %q#D", i, newdecl);
error ("after previous specification in %q+#D", inform (DECL_SOURCE_LOCATION (olddecl),
"previous specification in %q#D here",
olddecl); olddecl);
} }
} }
...@@ -1805,7 +1810,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1805,7 +1810,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
if (warning (OPT_Wredundant_decls, if (warning (OPT_Wredundant_decls,
"redundant redeclaration of %qD in same scope", "redundant redeclaration of %qD in same scope",
newdecl)) newdecl))
inform (input_location, "previous declaration of %q+D", olddecl); inform (DECL_SOURCE_LOCATION (olddecl),
"previous declaration of %qD", olddecl);
} }
if (!(DECL_TEMPLATE_INSTANTIATION (olddecl) if (!(DECL_TEMPLATE_INSTANTIATION (olddecl)
...@@ -1814,7 +1820,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1814,7 +1820,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
if (DECL_DELETED_FN (newdecl)) if (DECL_DELETED_FN (newdecl))
{ {
error ("deleted definition of %qD", newdecl); error ("deleted definition of %qD", newdecl);
error ("after previous declaration %q+D", olddecl); inform (DECL_SOURCE_LOCATION (olddecl),
"previous declaration of %qD", olddecl);
} }
DECL_DELETED_FN (newdecl) |= DECL_DELETED_FN (olddecl); DECL_DELETED_FN (newdecl) |= DECL_DELETED_FN (olddecl);
} }
......
2013-12-05 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/cpp0x/constexpr-46336.C: Adjust expected messages.
* g++.dg/cpp0x/defaulted2.C: Likewise.
* g++.dg/cpp1y/auto-fn8.C: Likewise.
* g++.dg/gomp/udr-3.C: Likewise.
* g++.dg/lookup/extern-c-redecl5.C: Likewise.
* g++.dg/lookup/linkage1.C: Likewise.
* g++.dg/overload/new1.C: Likewise.
* g++.dg/parse/friend5.C: Likewise.
* g++.dg/parse/namespace-alias-1.C: Likewise.
* g++.dg/parse/namespace10.C: Likewise.
* g++.dg/parse/redef2.C: Likewise.
* g++.dg/template/friend44.C: Likewise.
* g++.old-deja/g++.brendan/crash42.C: Likewise.
* g++.old-deja/g++.brendan/crash52.C: Likewise.
* g++.old-deja/g++.brendan/crash55.C: Likewise.
* g++.old-deja/g++.jason/overload21.C: Likewise.
* g++.old-deja/g++.jason/overload5.C: Likewise.
* g++.old-deja/g++.jason/redecl1.C: Likewise.
* g++.old-deja/g++.law/arm8.C: Likewise.
* g++.old-deja/g++.other/main1.C: Likewise.
2013-12-05 Richard Biener <rguenther@suse.de> 2013-12-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/56787 PR tree-optimization/56787
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
extern "C" { extern "C" {
enum A { }; enum A { };
inline constexpr A inline constexpr A
f(A a, A b) // { dg-error "previous declaration" } f(A a, A b) // { dg-message "previous declaration" }
{ return A(static_cast<int>(a) & static_cast<int>(b)); } { return A(static_cast<int>(a) & static_cast<int>(b)); }
enum B { }; enum B { };
inline constexpr B inline constexpr B
......
// Negative test for defaulted/deleted fns. // Negative test for defaulted/deleted fns.
// { dg-options "-std=c++11" } // { dg-options "-std=c++11" }
void f(); // { dg-error "previous" } void f(); // { dg-message "previous" }
void f() = delete; // { dg-error "deleted" } void f() = delete; // { dg-error "deleted" }
struct A struct A
......
// { dg-options "-std=c++1y -pedantic-errors" } // { dg-options "-std=c++1y -pedantic-errors" }
auto f() { return 42; } // { dg-error "old declaration .auto" } auto f() { return 42; } // { dg-message "old declaration .auto" }
auto f(); // OK auto f(); // OK
int f(); // { dg-error "new declaration" } int f(); // { dg-error "new declaration" }
......
...@@ -63,12 +63,12 @@ int y = f4 <S> (); ...@@ -63,12 +63,12 @@ int y = f4 <S> ();
namespace N1 namespace N1
{ {
#pragma omp declare reduction (+: ::S: omp_out.s *= omp_in.s) // { dg-error "previous" } #pragma omp declare reduction (+: ::S: omp_out.s *= omp_in.s) // { dg-message "previous" }
#pragma omp declare reduction (+: S: omp_out.s += omp_in.s) // { dg-error "redeclaration of" } #pragma omp declare reduction (+: S: omp_out.s += omp_in.s) // { dg-error "redeclaration of" }
void void
f5 () f5 ()
{ {
#pragma omp declare reduction (f5: S: omp_out.s *= omp_in.s) // { dg-error "previous" } #pragma omp declare reduction (f5: S: omp_out.s *= omp_in.s) // { dg-message "previous" }
#pragma omp declare reduction (f5: ::S: omp_out.s += omp_in.s) // { dg-error "redeclaration of" } #pragma omp declare reduction (f5: ::S: omp_out.s += omp_in.s) // { dg-error "redeclaration of" }
} }
} }
...@@ -84,10 +84,10 @@ namespace N2 ...@@ -84,10 +84,10 @@ namespace N2
namespace N3 namespace N3
{ {
#pragma omp declare reduction (+: ::S: omp_out.s *= omp_in.s) // { dg-error "previous" } #pragma omp declare reduction (+: ::S: omp_out.s *= omp_in.s) // { dg-message "previous" }
#pragma omp declare reduction (+: T: omp_out.t += omp_in.t) #pragma omp declare reduction (+: T: omp_out.t += omp_in.t)
#pragma omp declare reduction (+: S: omp_out.s += omp_in.s) // { dg-error "redeclaration of" } #pragma omp declare reduction (+: S: omp_out.s += omp_in.s) // { dg-error "redeclaration of" }
#pragma omp declare reduction (n3: long: omp_out += omp_in) // { dg-error "previous" } #pragma omp declare reduction (n3: long: omp_out += omp_in) // { dg-message "previous" }
#pragma omp declare reduction (n3: long int: omp_out += omp_in) // { dg-error "redeclaration of" } #pragma omp declare reduction (n3: long int: omp_out += omp_in) // { dg-error "redeclaration of" }
#pragma omp declare reduction (n3: short unsigned: omp_out += omp_in) #pragma omp declare reduction (n3: short unsigned: omp_out += omp_in)
#pragma omp declare reduction (n3: short int: omp_out += omp_in) #pragma omp declare reduction (n3: short int: omp_out += omp_in)
...@@ -95,9 +95,9 @@ namespace N3 ...@@ -95,9 +95,9 @@ namespace N3
f6 () f6 ()
{ {
#pragma omp declare reduction (f6: T: omp_out.t += omp_in.t) #pragma omp declare reduction (f6: T: omp_out.t += omp_in.t)
#pragma omp declare reduction (f6: S: omp_out.s *= omp_in.s) // { dg-error "previous" } #pragma omp declare reduction (f6: S: omp_out.s *= omp_in.s) // { dg-message "previous" }
#pragma omp declare reduction (f6: ::S: omp_out.s += omp_in.s) // { dg-error "redeclaration of" } #pragma omp declare reduction (f6: ::S: omp_out.s += omp_in.s) // { dg-error "redeclaration of" }
#pragma omp declare reduction (f6: long: omp_out += omp_in) // { dg-error "previous" } #pragma omp declare reduction (f6: long: omp_out += omp_in) // { dg-message "previous" }
#pragma omp declare reduction (f6: long int: omp_out += omp_in) // { dg-error "redeclaration of" } #pragma omp declare reduction (f6: long int: omp_out += omp_in) // { dg-error "redeclaration of" }
#pragma omp declare reduction (f6: short unsigned: omp_out += omp_in) #pragma omp declare reduction (f6: short unsigned: omp_out += omp_in)
#pragma omp declare reduction (f6: short int: omp_out += omp_in) #pragma omp declare reduction (f6: short int: omp_out += omp_in)
...@@ -124,7 +124,7 @@ namespace N5 ...@@ -124,7 +124,7 @@ namespace N5
int int
f7 () f7 ()
{ {
#pragma omp declare reduction (f7: T: omp_out.s *= omp_in.s) // { dg-error "previous" } #pragma omp declare reduction (f7: T: omp_out.s *= omp_in.s) // { dg-message "previous" }
#pragma omp declare reduction (f7: T: omp_out.s += omp_in.s) // { dg-error "redeclaration of" } #pragma omp declare reduction (f7: T: omp_out.s += omp_in.s) // { dg-error "redeclaration of" }
return 0; return 0;
} }
...@@ -145,9 +145,9 @@ namespace N6 ...@@ -145,9 +145,9 @@ namespace N6
f8 () f8 ()
{ {
#pragma omp declare reduction (f8: T: omp_out.t += omp_in.t) #pragma omp declare reduction (f8: T: omp_out.t += omp_in.t)
#pragma omp declare reduction (f8: U: omp_out.s *= omp_in.s) // { dg-error "previous" } #pragma omp declare reduction (f8: U: omp_out.s *= omp_in.s) // { dg-message "previous" }
#pragma omp declare reduction (f8: ::S: omp_out.s += omp_in.s) // { dg-error "redeclaration of" } #pragma omp declare reduction (f8: ::S: omp_out.s += omp_in.s) // { dg-error "redeclaration of" }
#pragma omp declare reduction (f8: long: omp_out += omp_in) // { dg-error "previous" } #pragma omp declare reduction (f8: long: omp_out += omp_in) // { dg-message "previous" }
#pragma omp declare reduction (f8: long int: omp_out += omp_in) // { dg-error "redeclaration of" } #pragma omp declare reduction (f8: long int: omp_out += omp_in) // { dg-error "redeclaration of" }
#pragma omp declare reduction (f8: short unsigned: omp_out += omp_in) #pragma omp declare reduction (f8: short unsigned: omp_out += omp_in)
#pragma omp declare reduction (f8: short int: omp_out += omp_in) #pragma omp declare reduction (f8: short int: omp_out += omp_in)
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
class frok class frok
{ {
int this_errno; int this_errno;
friend int fork (void); // { dg-error "previous declaration .*?C\\+\\+. linkage" } friend int fork (void); // { dg-message "previous declaration .*?C\\+\\+. linkage" }
}; };
extern "C" int extern "C" int
fork (void) // { dg-error "conflicts with new declaration .*?C. linkage" }} fork (void) // { dg-error "conflicting declaration .*?C. linkage" }}
{ {
frok grouped; frok grouped;
return grouped.this_errno; return grouped.this_errno;
......
// DR 563 // DR 563
extern int i; // { dg-error "linkage" } extern int i; // { dg-message "linkage" }
extern "C" int i; // { dg-error "linkage" } extern "C" int i; // { dg-error "linkage" }
...@@ -7,7 +7,7 @@ struct X{ ...@@ -7,7 +7,7 @@ struct X{
}; };
void f(X *x = new X); // { dg-error "" } void f(X *x = new X); // { dg-message "" }
void f(X *x = new X(4)); // { dg-error "" } void f(X *x = new X(4)); // { dg-error "" }
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
extern "C" struct A extern "C" struct A
{ {
friend void foo(int) {} // { dg-error "declaration" } friend void foo(int) {} // { dg-message "declaration" }
friend void foo() {} // { dg-error "foo" "err" } friend void foo() {} // { dg-error "foo" "err" }
}; };
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
namespace N namespace N
{ {
namespace M = N; // { dg-error "previous declaration" } namespace M = N; // { dg-message "previous declaration" }
namespace M {} // { dg-error "declaration of namespace" } namespace M {} // { dg-error "declaration of namespace" }
} }
// PR c++/16529 // PR c++/16529
namespace m {} // { dg-error "" } namespace m {} // { dg-message "" }
namespace n { namespace n {
namespace m {} namespace m {}
......
// { dg-do compile } // { dg-do compile }
char * d [10]; // { dg-message "8: 'd' has a previous declaration as" } char * d [10]; // { dg-message "8: previous declaration as" }
char e [15][10]; char e [15][10];
int (*f)(); int (*f)();
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
template<int> struct A template<int> struct A
{ {
friend int foo(); // { dg-error "14:new declaration" } friend int foo(); // { dg-error "14:ambiguating new declaration" }
}; };
void foo() { A<0> a; } // { dg-error "6:ambiguates old declaration" } void foo() { A<0> a; } // { dg-message "6:old declaration" }
// { dg-do assemble } // { dg-do assemble }
// GROUPS passed old-abort // GROUPS passed old-abort
int fn();// { dg-error "" } ambiguates.* int fn();// { dg-message "" } ambiguates.*
int x; int x;
int& fn() {// { dg-error "" } new decl.* int& fn() {// { dg-error "" } new decl.*
return x;} return x;}
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
class A { class A {
public: public:
friend A f(A &a);// { dg-error "ambiguates" } friend A f(A &a);// { dg-message "old declaration" }
}; };
A &f(A &a) {// { dg-error "new decl" } A &f(A &a) {// { dg-error "new declaration" }
std::cout << "Blah\n"; std::cout << "Blah\n";
} // { dg-warning "no return statement" } } // { dg-warning "no return statement" }
// { dg-do compile } // { dg-do compile }
// GROUPS passed old-abort // GROUPS passed old-abort
extern int f(int); // { dg-error "ambiguates" } extern int f(int); // { dg-message "old declaration" }
int& f(int x) // { dg-error "new declaration" } int& f(int x) // { dg-error "new declaration" }
{ {
......
// { dg-do assemble } // { dg-do assemble }
struct X { struct X {
void f (int = 4, char = 'r'); // { dg-error "previous specification" } void f (int = 4, char = 'r'); // { dg-error "previous specification" }
void g (int = 4, char = 'r'); // { dg-error "previous specification" } void g (int = 4, char = 'r'); // { dg-message "previous specification" }
}; };
void void
......
// { dg-do assemble } // { dg-do assemble }
// Testcase for simple overloading resolution. // Testcase for simple overloading resolution.
int foo (); // { dg-error "" } int foo (); // { dg-message "" }
void foo (); // { dg-error "" } disallowed overload void foo (); // { dg-error "" } disallowed overload
...@@ -3,7 +3,7 @@ class A ...@@ -3,7 +3,7 @@ class A
{ {
public: public:
A (const A& ccref); A (const A& ccref);
friend A const re (const A& v1); // { dg-error "ambiguates" } friend A const re (const A& v1); // { dg-message "old declaration" }
}; };
A // const A // const
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// Date: Tue, 16 Mar 93 12:05:24 +0100 // Date: Tue, 16 Mar 93 12:05:24 +0100
struct K { struct K {
void f( int *p = 0); // { dg-error "" } previous specification void f( int *p = 0); // { dg-message "" } previous specification
}; };
extern int * q; extern int * q;
......
// { dg-do compile } // { dg-do compile }
int main() // { dg-error "previous declaration" } int main() // { dg-message "previous declaration" }
{ {
return 0; return 0;
} }
int main(int, const char**) // { dg-error "conflicts" } int main(int, const char**) // { dg-error "conflicting" }
{ {
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment