https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85464

            Bug ID: 85464
           Summary: Wignored-qualifiers is emitted by cc1plus without
                    diagnostics when triggered by a cast operator.
           Product: gcc
           Version: 7.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: janniksilvanus at gmail dot com
  Target Milestone: ---

Consider the following example:

struct Test {
   operator int const() const;
};

When compiling using

g++ -Wextra -c cast.C

I get 

cc1plus: warning: type qualifiers ignored on function return type
[-Wignored-qualifiers]

Note that the warning is emitted by cc1plus instead of g++, and does not
contain any further info about e.g. the line that triggers this warning.

Output of g++ -v:
Target: x86_64-redhat-linux
Configured with: ./../gcc-7.3.0/configure --prefix=/lfs/vlsi/tools/gcc/7.3.0
--disable-multilib --enable-languages=c,c++,lto --enable-bootstrap
--enable-shared --enable-threads=posix --enable-checking=release
--with-system-zlib --enable-gnu-unique-object
--with-default-libstdcxx-abi=gcc4-compatible --enable-libmpx
--enable-gnu-indirect-function --with-tune=generic --build=x86_64-redhat-linux
--with-advance-toolchain=/opt/rh/devtoolset-7/root/
Thread model: posix
gcc version 7.3.0 (GCC)

The same problem seems to be present with version 7.1.0, but not with 6.1.0
(although gcc-6.1.0 places the marker on the wrong const, i.e. the last const
of the line, which seems to have been reported and fixed via bug 69733).

Reply via email to