public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/44524]  New: improve diagnostic for . vs -> typo
@ 2010-06-13 14:05 manu at gcc dot gnu dot org
  2010-06-13 17:28 ` [Bug c++/44524] " pinskia at gcc dot gnu dot org
  2010-08-16 19:12 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 6+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-06-13 14:05 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <bug-44524-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2011-10-17 17:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-13 14:05 [Bug c++/44524] New: improve diagnostic for . vs -> typo manu at gcc dot gnu dot org
2010-06-13 17:28 ` [Bug c++/44524] " pinskia at gcc dot gnu dot org
2010-08-16 19:12 ` pinskia at gcc dot gnu dot org
     [not found] <bug-44524-4@http.gcc.gnu.org/bugzilla/>
2011-10-17 12:25 ` paolo.carlini at oracle dot com
2011-10-17 17:51 ` paolo at gcc dot gnu.org
2011-10-17 17:52 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).