public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/23194] New: Unhelpful diagnostic for incorrect pointer-to-member function syntax
@ 2005-08-02  6:38 redi at gcc dot gnu dot org
  2005-08-02  6:41 ` [Bug c++/23194] " pinskia at gcc dot gnu dot org
  2005-08-02  8:45 ` redi at gcc dot gnu dot org
  0 siblings, 2 replies; 15+ messages in thread
From: redi at gcc dot gnu dot org @ 2005-08-02  6:38 UTC (permalink / raw)
  To: gcc-bugs

Given:

struct A {
    void mf() {}
};

int main()
{
    void (A::*pmf)() = &A::mf;
    A a;
    a.*pmf();   // should be (a.*pmf)();
}

mainline GCC says to use .* or ->* to use the PMF,

pfm_diag.cc: In function 'int main()':
pfm_diag.cc:9: error: must use '.*' or '->*' to call pointer-to-member function
in 'pmf (...)'

This is unhelpful if you don't know the right syntax, because the correct
operator _is_ present, but the compiler is complaining about the expression to
the right of the operator.  Maybe it would be better if the error message had a
complete example after it:

pfm_diag.cc: In function 'int main()':
pfm_diag.cc:9: error: must use '.*' or '->*' to call pointer-to-member function
in 'pmf (...)', e.g. '(a.*f) (...)'

-- 
           Summary: Unhelpful diagnostic for incorrect pointer-to-member
                    function syntax
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: redi at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23194


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2008-06-24 20:47 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-23194-5876@http.gcc.gnu.org/bugzilla/>
2007-10-02 22:08 ` [Bug c++/23194] Unhelpful diagnostic for incorrect pointer-to-member function syntax bangerth at dealii dot org
2007-10-02 23:28 ` jwakely dot gcc at gmail dot com
2007-10-02 23:30 ` bangerth at dealii dot org
2007-10-02 23:54 ` jwakely dot gcc at gmail dot com
2007-10-02 23:59   ` Andrew Pinski
2007-10-02 23:59 ` pinskia at gmail dot com
2007-10-03  0:00 ` jwakely dot gcc at gmail dot com
2007-10-03  0:03 ` bangerth at dealii dot org
2007-10-03  0:16 ` jwakely dot gcc at gmail dot com
2007-10-03  0:24 ` pinskia at gcc dot gnu dot org
2007-10-03  0:32 ` jwakely dot gcc at gmail dot com
2008-06-24 20:45 ` redi at gcc dot gnu dot org
2008-06-24 20:47 ` jwakely dot gcc at gmail dot com
2005-08-02  6:38 [Bug c++/23194] New: " redi at gcc dot gnu dot org
2005-08-02  6:41 ` [Bug c++/23194] " pinskia at gcc dot gnu dot org
2005-08-02  8:45 ` redi at gcc dot gnu dot org

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).