[Bug c++/64431] "-Wignored-qualifiers" warning gives misleading position in code
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 29 01:50:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64431
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-12-29
CC| |manu at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
This is a problem also in C, however, in C++ it is trivial to fix:
Index: gcc/cp/decl.c
===================================================================
--- gcc/cp/decl.c (revision 218749)
+++ gcc/cp/decl.c (working copy)
@@ -9686,11 +9686,11 @@ grokdeclarator (const cp_declarator *dec
Make sure we have a valid type for the function to return. */
if (type_quals != TYPE_UNQUALIFIED)
{
if (SCALAR_TYPE_P (type) || VOID_TYPE_P (type))
- warning (OPT_Wignored_qualifiers,
+ warning_at (declspecs->locations[ds_const],
OPT_Wignored_qualifiers,
"type qualifiers ignored on function return type");
/* We now know that the TYPE_QUALS don't apply to the
decl, but to its return type. */
type_quals = TYPE_UNQUALIFIED;
}
I would suggest to add a testcase with explicit column numbers.
I added this to the list of EasyHacks and I'll leave it to a new dev to fix it
(see
https://gcc.gnu.org/wiki/GettingStarted#Basics:_Contributing_to_GCC_in_10_easy_steps
if you want to be the one)
More information about the Gcc-bugs
mailing list