[Bug c++/82219] New: [8 Regression] bogus warning: type qualifiers ignored on cast result type [-Wignored-qualifiers]
trippels at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 15 07:09:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82219
Bug ID: 82219
Summary: [8 Regression] bogus warning: type qualifiers ignored
on cast result type [-Wignored-qualifiers]
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: trippels at gcc dot gnu.org
Target Milestone: ---
trippels@gcc2-power8 src % cat test1.ii
struct A {
template <typename T> T foo(T *) const { return static_cast<T>(0); }
void bar() const { foo(&i); }
int i;
};
trippels@gcc2-power8 src % clang++ -Wall -Wextra -c test1.ii
trippels@gcc2-power8 src % ~/gcc_7/usr/local/bin/g++ -Wall -Wextra -c test1.ii
trippels@gcc2-power8 src % ~/gcc_8/usr/local/bin/g++ -Wall -Wextra -c test1.ii
test1.ii: In instantiation of ‘T A::foo(T*) const [with T = const int]’:
test1.ii:3:28: required from here
test1.ii:2:51: warning: type qualifiers ignored on cast result type
[-Wignored-qualifiers]
template <typename T> T foo(T *) const { return static_cast<T>(0); }
^~~~~~~~~~~~~~~~~
trippels@gcc2-power8 src % cat test2.ii
struct A {
template <typename T> static T foo(T *) { return static_cast<T>(0); }
void bar() const { foo(&i); }
int i;
};
trippels@gcc2-power8 src % clang++ -Wall -Wextra -c test2.ii
trippels@gcc2-power8 src % ~/gcc_7/usr/local/bin/g++ -Wall -Wextra -c test2.ii
trippels@gcc2-power8 src % ~/gcc_8/usr/local/bin/g++ -Wall -Wextra -c test2.ii
test2.ii: In instantiation of ‘static T A::foo(T*) [with T = const int]’:
test2.ii:3:28: required from here
test2.ii:2:52: warning: type qualifiers ignored on cast result type
[-Wignored-qualifiers]
template <typename T> static T foo(T *) { return static_cast<T>(0); }
^~~~~~~~~~~~~~~~~
More information about the Gcc-bugs
mailing list