[Bug c++/64431] "-Wignored-qualifiers" warning gives misleading position in code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64431 Paolo Carlini changed: What|Removed |Added CC||paolo.carlini at oracle dot com --- Comment #8 from Paolo Carlini --- The main issue is fixed for 7.1.0 in the straightforward way exploiting my smallest_type_quals_location. The location for Comment #5 is wrong, however.
[Bug c++/64431] "-Wignored-qualifiers" warning gives misleading position in code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64431 Paolo Carlini changed: What|Removed |Added Status|ASSIGNED|NEW Assignee|paolo.carlini at oracle dot com|unassigned at gcc dot gnu.org --- Comment #7 from Paolo Carlini --- Unfortunately, I'm not actively working on this.
[Bug c++/64431] "-Wignored-qualifiers" warning gives misleading position in code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64431 Paul Smith changed: What|Removed |Added CC||psmith at gnu dot org --- Comment #6 from Paul Smith --- Still see this in GCC 6.2.0. It was even more confusing for me because in my case the const in the return type was hidden in a typedef: class Foo { typedef const char* const MyType; ... MyType myFunction() const { ... } }; Shows this error: Foo.h:202:26: error: type qualifiers ignored on function return type MyType myFunction() const ^ I was _really_ confused :). I'm not even sure this should trigger this error... I mean, it's inside a type. In my case I can take it out without a big problem but what if I wanted to have the const in the type? Then I can't return that type anymore without a warning? Maybe that's a separate bug.
[Bug c++/64431] -Wignored-qualifiers warning gives misleading position in code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64431 --- Comment #5 from Paolo Carlini paolo.carlini at oracle dot com --- Note that, besides the cases of volatile and restrict which should be also included, already have a patch including those, we need further tweaks to recover the location of 'const' in: int* const f9();
[Bug c++/64431] -Wignored-qualifiers warning gives misleading position in code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64431 Paolo Carlini paolo.carlini at oracle dot com changed: What|Removed |Added Status|NEW |ASSIGNED CC|rutsky.vladimir at gmail dot com | Assignee|unassigned at gcc dot gnu.org |paolo.carlini at oracle dot com --- Comment #4 from Paolo Carlini paolo.carlini at oracle dot com --- Mine.
[Bug c++/64431] -Wignored-qualifiers warning gives misleading position in code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64431 Eugene Zelenko eugene.zelenko at gmail dot com changed: What|Removed |Added CC||eugene.zelenko at gmail dot com --- Comment #3 from Eugene Zelenko eugene.zelenko at gmail dot com --- Same problem exists in 4.8.2 and 4.8.3 and probably earlier versions. Will be good idea to fix problem there too. Eugene.
[Bug c++/64431] -Wignored-qualifiers warning gives misleading position in code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64431 --- Comment #1 from Vladimir Rutsky rutsky.vladimir at gmail dot com --- $ g++-4.9 -v Using built-in specs. COLLECT_GCC=g++-4.9 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.9.2-0ubuntu1~14.04' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.9 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.9.2 (Ubuntu 4.9.2-0ubuntu1~14.04)
[Bug c++/64431] -Wignored-qualifiers warning gives misleading position in code
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)