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]

c++/9851: confusing error message when using '.', not '->'


>Number:         9851
>Category:       c++
>Synopsis:       confusing error message when using '.', not '->'
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 25 19:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Jeffrey D. Oldham
>Release:        3.4 20030224 (experimental)
>Organization:
>Environment:
not applicable
>Description:
The C++ parser produces confusing error messages when trying to erroneously call a member function using the dot operator rather than the correct arrow operator.

For example, g_.do_nothing() causes these error messages:
foo.cc: In constructor `foo::foo()':
foo.cc:6: error: expected type-name
foo.cc:6: error: expected `::'
foo.cc:6: error: expected `~'
foo.cc:6: error: expected identifier

g++ 2.96 produces intelligible error messages:

foo.cc: In method `foo::foo ()':
foo.cc:6: request for member `do_nothing' in `this->foo::g_', which is of non-aggregate type `goo *'
>How-To-Repeat:
g++ -c foo.cc
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="foo.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="foo.cc"

c3RydWN0IGdvbyB7CiAgdm9pZCBkb19ub3RoaW5nICgpIHt9Owp9OwoKc3RydWN0IGZvbyB7CiAg
Zm9vICgpIHsgZ18uZG9fbm90aGluZyAoKTsgfQogIGdvbyAqIGdfOwp9Owo=


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