This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/69733] New: -Wignored-qualifiers points to wrong const


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

            Bug ID: 69733
           Summary: -Wignored-qualifiers points to wrong const
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org
  Target Milestone: ---

markus@x4 tmp % cat const.ii
class A {
 private:
   double val;
 public:
   const double value() const {return val;}
};

markus@x4 tmp % clang++ -c -Wall -Wextra const.ii
const.ii:5:4: warning: 'const' type qualifier on return type has no effect
[-Wignored-qualifiers]
   const double value() const {return val;}
   ^~~~~~
1 warning generated.

markus@x4 tmp % icpc -c -Wall -Wextra const.ii
const.ii(5): warning #858: type qualifier on return type is meaningless
     const double value() const {return val;}
     ^

markus@x4 tmp % g++ -c -Wall -Wextra const.ii
const.ii:5:25: warning: type qualifiers ignored on function return type
[-Wignored-qualifiers]
    const double value() const {return val;}
                         ^~~~~

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]