+2019-08-08 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * decl.c (grokdeclarator): Use id_loc and EXPR_LOCATION in
+ a few error messages.
+
2019-08-08 Marek Polacek <polacek@redhat.com>
PR c++/87519 - bogus warning with -Wsign-conversion.
ctype = qualifying_scope;
if (!MAYBE_CLASS_TYPE_P (ctype))
{
- error ("%q#T is not a class or a namespace", ctype);
+ error_at (id_declarator->id_loc,
+ "%q#T is not a class or namespace", ctype);
ctype = NULL_TREE;
}
else if (innermost_code != cdk_function
{
if (innermost_code != cdk_function)
{
- error ("declaration of %qD as non-function", decl);
+ error_at (EXPR_LOCATION (decl),
+ "declaration of %qE as non-function", decl);
return error_mark_node;
}
else if (!qualifying_scope
&& !(current_class_type && at_class_scope_p ()))
{
- error ("declaration of %qD as non-member", decl);
+ error_at (EXPR_LOCATION (decl),
+ "declaration of %qE as non-member", decl);
return error_mark_node;
}
else if (in_namespace && !friendp)
{
/* Something like struct S { int N::j; }; */
- error ("invalid use of %<::%>");
+ error_at (id_loc, "invalid use of %<::%>");
return error_mark_node;
}
else if (FUNC_OR_METHOD_TYPE_P (type) && unqualified_id)
if (!ctype)
{
gcc_assert (friendp);
- error ("expected qualified name in friend declaration "
- "for destructor %qD", uqname);
+ error_at (id_loc, "expected qualified name in friend "
+ "declaration for destructor %qD", uqname);
return error_mark_node;
}
if (!check_dtor_name (ctype, TREE_OPERAND (uqname, 0)))
{
- error ("declaration of %qD as member of %qT",
- uqname, ctype);
+ error_at (id_loc, "declaration of %qD as member of %qT",
+ uqname, ctype);
return error_mark_node;
}
if (concept_p)
+2019-08-08 Paolo Carlini <paolo.carlini@oracle.com>
+
+ * g++.dg/cpp0x/enum20.C: Test location(s) too.
+ * g++.dg/other/friend3.C: Likewise.
+ * g++.dg/parse/dtor5.C: Likewise.
+ * g++.dg/parse/friend7.C: Likewise.
+ * g++.dg/template/error22.C: Likewise.
+ * g++.old-deja/g++.brendan/err-msg5.C: Likewise.
+
2019-08-08 Jim Wilson <jimw@sifive.com>
PR target/91229
// { dg-do compile { target c++11 } }
enum A { };
-void A::f() { } // { dg-error "not a class" }
+void A::f() { } // { dg-error "6:.enum A. is not a class" }
struct A
{
- friend ~A(); // { dg-error "qualified name" }
+ friend ~A(); // { dg-error "10:expected qualified name" }
};
struct B
{
- friend ~A(); // { dg-error "qualified name" }
+ friend ~A(); // { dg-error "10:expected qualified name" }
};
// PR c++/19732
struct A;
-typedef int ~A; // { dg-error "non-function" }
+typedef int ~A; // { dg-error "13:declaration of .~ A. as non-function" }
struct B {
- ~A(); // { dg-error "" }
- typedef int ~A; // { dg-error "non-function" }
+ ~A(); // { dg-error "3:declaration of .~A. as member of .B." }
+ typedef int ~A; // { dg-error "15:declaration of .~ A. as non-function" }
void f() {
- extern ~B(); // { dg-error "non-member" }
+ extern ~B(); // { dg-error "12:declaration of .~ B. as non-member" }
}
};
-void ~A(); // { dg-error "non-member" }
+void ~A(); // { dg-error "6:declaration of .~ A. as non-member" }
struct C
{
friend int C ();
- friend int ~C (); // { dg-error "return type|in friend decl" }
+ friend int ~C (); // { dg-error "10:return type" }
+ // { dg-error "14:expected qualified name in friend decl" "" { target *-*-* } .-1 }
friend int C (const C &);
};
struct D
{
friend int D () {}
- friend int ~D () {} // { dg-error "return type|in friend decl" }
+ friend int ~D () {} // { dg-error "10:return type" }
+ // { dg-error "14:expected qualified name in friend decl" "" { target *-*-* } .-1 }
friend int D (const D &) {}
};
struct A
{
template<void (A::*)()> struct B {};
- void ::foo(); // { dg-error "invalid use" }
+ void ::foo(); // { dg-error "10:invalid use" }
B<&A::foo> b; // { dg-error "incomplete type|template argument" }
};
// { dg-do assemble }
// GROUPS passed error-messages
class foo {};
-~foo () {}// { dg-error "" } destructors must be member functions.*
+~foo () {}// { dg-error "1:declaration of .~ foo. as non-member" } destructors must be member functions.*