[Bug c++/44524] New: improve diagnostic for . vs -> typo
manu at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sun Jun 13 14:05:00 GMT 2010
Testcase:
#include <map>
int bar(std::map<int, float> *X) {
return X.empty();
}
gcc-4.6:
/home/manuel/test/src/gcc/testsuite/g++.dg/warn/clang-11.C: In function 'int
bar(std::map<int, float>*)':^M
/home/manuel/test/src/gcc/testsuite/g++.dg/warn/clang-11.C:4:12: error: request
for member 'empty' in 'X', which is of non-class type 'std::map<int, float>*'
clang:
t.cc:4:11: error: member reference type 'std::map<int, float> *' is a pointer;
maybe you meant to use '->'?
return X.empty();
~^
->
In GCC, we would need to mention X and empty somewhere in addition to the type.
I would suggest:
error: request for member 'empty' in 'X', which has pointer type 'std::map<int,
float> *' ; maybe you meant to use '->'
--
Summary: improve diagnostic for . vs -> typo
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: manu at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44524
More information about the Gcc-bugs
mailing list