+2016-06-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * decl.c (xref_tag_1): Change pairs of errors to error + inform.
+ (start_enum): Likewise.
+ * parser.c (cp_parser_class_head): Likewise.
+
2016-06-02 Jakub Jelinek <jakub@redhat.com>
PR c++/71372
&& CLASSTYPE_IS_TEMPLATE (t))
{
error ("redeclaration of %qT as a non-template", t);
- error ("previous declaration %q+D", t);
+ inform (location_of (t), "previous declaration %qD", t);
return error_mark_node;
}
{
error_at (input_location, "scoped/unscoped mismatch "
"in enum %q#T", enumtype);
- error_at (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)),
- "previous definition here");
+ inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)),
+ "previous definition here");
enumtype = error_mark_node;
}
else if (ENUM_FIXED_UNDERLYING_TYPE_P (enumtype) != !! underlying_type)
{
error_at (input_location, "underlying type mismatch "
"in enum %q#T", enumtype);
- error_at (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)),
- "previous definition here");
+ inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)),
+ "previous definition here");
enumtype = error_mark_node;
}
else if (underlying_type && ENUM_UNDERLYING_TYPE (enumtype)
{
error_at (input_location, "different underlying type "
"in enum %q#T", enumtype);
- error_at (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)),
- "previous definition here");
+ inform (DECL_SOURCE_LOCATION (TYPE_MAIN_DECL (enumtype)),
+ "previous definition here");
underlying_type = NULL_TREE;
}
}
{
error_at (type_start_token->location, "redefinition of %q#T",
type);
- error_at (type_start_token->location, "previous definition of %q+#T",
- type);
+ inform (location_of (type), "previous definition of %q#T",
+ type);
type = NULL_TREE;
goto done;
}
+2016-06-02 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * g++.dg/cpp0x/forw_enum10.C: Adjust for dg-message vs dg-error.
+ * g++.dg/cpp0x/forw_enum6.C: Likewise.
+ * g++.dg/cpp0x/forw_enum8.C: Likewise.
+ * g++.dg/cpp0x/override2.C: Likewise.
+ * g++.dg/parse/crash5.C: Likewise.
+ * g++.dg/parse/error16.C: Likewise.
+ * g++.dg/parse/error27.C: Likewise.
+ * g++.dg/template/qualttp15.C: Likewise.
+ * g++.dg/template/redecl4.C: Likewise.
+ * g++.old-deja/g++.other/crash39.C: Likewise.
+ * g++.old-deja/g++.other/struct1.C: Likewise.
+ * g++.old-deja/g++.pt/m9a.C: Likewise.
+ * g++.old-deja/g++.pt/memclass10.C: Likewise.
+
2016-06-02 Jakub Jelinek <jakub@redhat.com>
PR c++/71372
//This error is diagnosed at instantiation time
template<typename T> struct S1
{
- enum E : T; // { dg-error "previous definition" }
+ enum E : T; // { dg-message "previous definition" }
enum E : int; // { dg-error "different underlying type" }
};
template struct S1<short>; // { dg-message "required from here" }
template<typename T1, typename T2> struct S4
{
- enum E : T1; // { dg-error "previous definition" }
+ enum E : T1; // { dg-message "previous definition" }
enum E : T2; // { dg-error "different underlying type" }
};
template struct S4<short,char>; // { dg-message "required from here" }
// { dg-do compile { target c++11 } }
-enum class E1 : int; // { dg-error "previous definition" }
+enum class E1 : int; // { dg-message "previous definition" }
enum E1 : int; // { dg-error "scoped/unscoped mismatch" }
-enum E2 : int; // { dg-error "previous definition" }
+enum E2 : int; // { dg-message "previous definition" }
enum class E2 : int; // { dg-error "scoped/unscoped mismatch" }
enum struct E3 : int;
enum class E3 : int; //ok
-enum class E4 : int; // { dg-error "previous definition" }
+enum class E4 : int; // { dg-message "previous definition" }
enum class E4 : long; // { dg-error "different underlying type" }
-enum E5 : int; // { dg-error "previous definition" }
+enum E5 : int; // { dg-message "previous definition" }
enum E5 : long; // { dg-error "different underlying type" }
enum E6 : int;
//This error is diagnosed at instantiation time
template<typename T> struct S2
{
- enum E : int; // { dg-error "previous definition" }
+ enum E : int; // { dg-message "previous definition" }
enum E : T; // { dg-error "different underlying type" }
};
template struct S2<short>; // { dg-message "required from here" }
//This error is diagnosed at compilation time
template<typename T> struct S3
{
- enum E : int; // { dg-error "previous definition" }
+ enum E : int; // { dg-message "previous definition" }
enum E : short; // { dg-error "different underlying type" }
};
{
D3<B1> d;
D4<B2> d2;
- struct B2 final{}; // { dg-error "previous definition" }
+ struct B2 final{}; // { dg-message "previous definition" }
B2 final; // { dg-error "has a previous declaration|previously declared here" }
B2 final2 = final;
struct B2 {}; // { dg-error "redefinition" }
struct B2 final {}; // { dg-error "redefinition" }
struct B2 override {}; // { dg-error "cannot specify 'override' for a class" }
B2 override{}; // { dg-error "redeclaration" }
- struct foo final {}; // { dg-error "previous definition" }
+ struct foo final {}; // { dg-message "previous definition" }
struct foo final {}; // { dg-error "redefinition" }
foo final; // { dg-error "conflicting declaration" }
}
// { dg-options "-w" }
-class QString { // { dg-error "previous definition" }
+class QString { // { dg-message "previous definition" }
QString (const QString & a); // { dg-message "QString::QString|candidate expects" }
};
struct A
{
- struct B {}; // { dg-error "10:previous definition of 'struct A::B'" }
+ struct B {}; // { dg-message "10:previous definition of 'struct A::B'" }
};
struct A::B{}; // { dg-error "11:redefinition of 'struct A::B'" }
// { dg-options "-fshow-column -ansi -pedantic-errors -Wno-long-long" }
// PR c++/20152
-struct KrSelectionMode { virtual void init() = 0; }; // { dg-error "8:previous definition of 'struct KrSelectionMode'" }
-struct KrKDESelectionMode : public KrSelectionMode { void init() { } }; // { dg-error "8:previous definition of 'struct KrKDESelectionMode'" }
+struct KrSelectionMode { virtual void init() = 0; }; // { dg-message "8:previous definition of 'struct KrSelectionMode'" }
+struct KrKDESelectionMode : public KrSelectionMode { void init() { } }; // { dg-message "8:previous definition of 'struct KrKDESelectionMode'" }
struct KrSelectionMode { virtual void init() = 0; }; // { dg-error "8:redefinition of 'struct KrSelectionMode'" }
struct KrKDESelectionMode : public KrSelectionMode { void init() { } }; // { dg-error "8:redefinition of 'struct KrKDESelectionMode'" }
KrKDESelectionMode krKDESelectionMode;
TT<int> y;
};
-template <class T> struct X<T::template B> // { dg-error "previous" }
+template <class T> struct X<T::template B> // { dg-message "previous" }
{
T z;
};
// PR c++/28710
// { dg-do compile }
-template<int> union A; // { dg-error "previous" }
+template<int> union A; // { dg-message "previous" }
struct A; // { dg-error "non-template" }
{
~X ();
};
-struct S { X a; }; // { dg-error "" } previous defn
+struct S { X a; }; // { dg-message "" } previous defn
struct S { X a; }; // { dg-error "" } redefinition
void c1(S s)
// Duplicate definitions are wrong, we should just cough
// politely, but we used to die horribly.
-class Y // { dg-error "" } previous definition
+class Y // { dg-message "" } previous definition
{
};
class Y // { dg-error "" } redefinition
{
};
-template<class T> class X // { dg-error "" } previous definition
+template<class T> class X // { dg-message "" } previous definition
{
};
template<class T> class X // { dg-error "" } redefinition
{
};
-template<class T> class X<T *> // { dg-error "" } previous definition
+template<class T> class X<T *> // { dg-message "" } previous definition
{
};
template<class T> class X<T *> // { dg-error "" } redefinition
{
};
-template<> class X<int> // { dg-error "" } previous definition
+template<> class X<int> // { dg-message "" } previous definition
{
};
template<> class X<int> // { dg-error "" } redefinition
{
};
-template<> class X<int *> // { dg-error "" } previous definition
+template<> class X<int *> // { dg-message "" } previous definition
{
};
template<> class X<int *> // { dg-error "" } redefinition
// { dg-do assemble }
-struct A { A() { a = 1; } int a; }; // { dg-error "" }
+struct A { A() { a = 1; } int a; }; // { dg-message "" }
struct A { A() { a = 2; } int a; }; // { dg-error "" }
A aavv;
struct S1
{
template <class T>
- struct S2 {}; // { dg-error "" } previous definition
+ struct S2 {}; // { dg-message "" } previous definition
template <class T>
struct S2 {}; // { dg-error "" } redefinition